ishara / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

SecurityException accessing Classloader with jdk8u40 #187

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use orika (1.4.5 or 1.4.6-SNAPSHOT) with the jdk8u40
2. try to map any object with bidirectional association
3. Exception occurs because claassloader in no longer accessible with jdk8u40

here the trace :

java.lang.SecurityException: Cannot make java.lang.Class.classLoader accessible
    at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:147)
    at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:129)
    at com.carrotsearch.sizeof.RamUsageEstimator.createCacheEntry(RamUsageEstimator.java:574)
    at com.carrotsearch.sizeof.RamUsageEstimator.measureSizeOf(RamUsageEstimator.java:532)
    at com.carrotsearch.sizeof.RamUsageEstimator.sizeOfAll(RamUsageEstimator.java:380)
    at com.carrotsearch.sizeof.RamUsageEstimator.sizeOfAll(RamUsageEstimator.java:361)
    at ma.glasnost.orika.StateReporter.humanReadableSizeInMemory(StateReporter.java:48)
    at ma.glasnost.orika.impl.DefaultMapperFactory.reportCurrentState(DefaultMapperFactory.java:1547)
    at ma.glasnost.orika.StateReporter.reportCurrentState(StateReporter.java:33)
    at ma.glasnost.orika.impl.ExceptionUtility.decorate(ExceptionUtility.java:65)
    at ma.glasnost.orika.impl.ExceptionUtility.newMappingException(ExceptionUtility.java:55)
    at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:745)
    at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:714)
    at ma.glasnost.orika.impl.ConfigurableMapper.map(ConfigurableMapper.java:150)
    at com.cardassiel.gui.test.mapper.MapperGameViewToDtoTI.testMapDTOToGameView(MapperGameViewToDtoTI.java:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
    at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

After investigating, it seems the classloader structure change for the jdk9 and 
Nashorn project and the classLoader can not be accessed by reflection anymore.

I can provide a total test case if needed

Original issue reported on code.google.com by jordan.h...@gmail.com on 18 Dec 2014 at 8:55

GoogleCodeExporter commented 8 years ago
Yes please it could be helpful

Original comment by elaat...@gmail.com on 20 Dec 2014 at 5:34

GoogleCodeExporter commented 8 years ago
I'm sorry but i'm very busy with christmas, i don't have time to extract a test 
case from my application.
But, i've tried to build Orika Master and there is test failure with the same 
exception i've seen on my app

At ma.glasnost.orika.test.converter.NumericConvertersTestCase :

testFloatToLongConverter_overflow
testLongToIntegerConverter_overflow
testDoubleToLongConverter_overflow
testIntegerToShortConverter_overflow
testLongToShortConverter_overflow
testDoubleToIntegerConverter_overflow
testFloatToShortConverter_overflow
testDoubleToShortConverter_overflow
testBigIntegerToLongConverter_Overflow
testFloatToIntegerConverter_overflow
testBigIntegerToIntegerConverter_Overflow

And at ma.glasnost.orika.test.converter.ToStringConverterTestCase
testToString_withoutConverter

The exception is exactly the same : java.lang.SecurityException: Cannot make 
java.lang.Class.classLoader accessible

I've joined a file with debug mode test from maven.

Original comment by jordan.h...@gmail.com on 28 Dec 2014 at 4:26

Attachments: