You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (JIRA)" <ji...@apache.org> on 2019/04/30 09:31:00 UTC
[jira] [Created] (CAY-2573) DI field injection is triggered when
creating sql Driver
Nikita Timofeev created CAY-2573:
------------------------------------
Summary: DI field injection is triggered when creating sql Driver
Key: CAY-2573
URL: https://issues.apache.org/jira/browse/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:
{code:java}
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)
{code}
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)