cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikita Timofeev (JIRA)" <>
Subject [jira] [Created] (CAY-2573) DI field injection is triggered when creating sql Driver
Date Tue, 30 Apr 2019 09:31:00 GMT
Nikita Timofeev created CAY-2573:

             Summary: DI field injection is triggered when creating sql Driver
                 Key: CAY-2573
             Project: Cayenne
          Issue Type: Bug
          Components: Database integration
    Affects Versions: 4.1.B1, 4.0.1
            Reporter: Nikita Timofeev
             Fix For: 4.0.2, 4.1.B2, 4.2.M1

Some of {{DataSourceFactory}} implementations (namely {{DriverDataSourceFactory}}, {{PropertyDataSourceFactory}}
and {{XMLPoolingDataSourceFactory}}) are using {{AdhocObjectFactory}} to create {{Driver}}
instance. This have one nasty side effect: DI field injection is used in a process and it
can lead to errors.

This is an exception that is thrown by SAP HANA driver in that case:
java.lang.NoClassDefFoundError: Ljava/lang/ref/Cleaner;

	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(
	at java.lang.Class.getDeclaredFields(
	at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(
	at org.apache.cayenne.di.spi.FieldInjectingProvider.get(
	at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(

I believe we should use only {{getJavaClass()}} method of {{AdhocObjectFactory}}. As a more
distant solution we can check usage of {{DriverManager}} instead of detecting and using {{Driver}}

This message was sent by Atlassian JIRA

View raw message