-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 4.0.1, 4.1.B1
-
Component/s: Database integration
-
Labels:None
Some of DataSourceFactory implementations (namely DriverDataSourceFactory, PropertyDataSourceFactory and XMLPoolingDataSourceFactory) useĀ 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(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) at org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(FieldInjectingProvider.java:55) at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:44) at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:70)
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 explicitly.