cayenne-commits mailing list archives

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

     [ https://issues.apache.org/jira/browse/CAY-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Nikita Timofeev updated CAY-2573:
---------------------------------
    Description: 
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.

  was:
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.


> 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.B2, 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)

Mime
View raw message