You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Arseni Bulatski (JIRA)" <ji...@apache.org> on 2019/06/07 12:07:00 UTC

[jira] [Commented] (CAY-2573) DI field injection is triggered when creating sql Driver

    [ https://issues.apache.org/jira/browse/CAY-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16858561#comment-16858561 ] 

Arseni Bulatski commented on CAY-2573:
--------------------------------------

*4.0* [https://github.com/apache/cayenne/commit/8830e8cef12f8b065a71d9827cf183d43988dfcf]

 

> 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.0.1, 4.1.B1
>            Reporter: Nikita Timofeev
>            Priority: Major
>             Fix For: 4.0.2, 4.1.B3, 4.2.M1
>
>
> 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:
> {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)