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

Uwe Schindler commented on SOLR-9893:
-------------------------------------

Sample stack trace:

{noformat}
   [junit4] ERROR   0.38s J2 | TestManagedSchemaThreadSafety.testThreadSafety 
<<<
   [junit4]    > Throwable #1: java.lang.ExceptionInInitializerError
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([8E654E5E1F32A757:142F5A06CCAD15A1]:0)
   [junit4]    >        at 
org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
   [junit4]    >        at 
org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
   [junit4]    >        at 
org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
   [junit4]    >        at 
org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
   [junit4]    >        at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
   [junit4]    >        at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
   [junit4]    >        at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
   [junit4]    >        at 
org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
   [junit4]    >        at 
org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:85)
   [junit4]    >        at 
org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:62)
   [junit4]    >        at 
org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:56)
   [junit4]    >        at 
org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
   [junit4]    >        at 
org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
   [junit4]    >        at 
org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
   [junit4]    >        at org.mockito.Mockito.mock(Mockito.java:1243)
   [junit4]    >        at 
org.apache.solr.schema.TestManagedSchemaThreadSafety.createZkController(TestManagedSchemaThreadSafety.java:135)
   [junit4]    >        at 
org.apache.solr.schema.TestManagedSchemaThreadSafety.testThreadSafety(TestManagedSchemaThreadSafety.java:118)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   [junit4]    >        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [junit4]    >        at 
java.base/java.lang.reflect.Method.invoke(Method.java:538)
   [junit4]    >        at java.base/java.lang.Thread.run(Thread.java:844)
   [junit4]    > Caused by: java.lang.reflect.InaccessibleObjectException: 
Unable to make protected final java.lang.Class 
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
 throws java.lang.ClassFormatError accessible: module java.base does not "opens 
java.lang" to unnamed module @4cbd6df7
   [junit4]    >        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:207)
   [junit4]    >        at 
java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
   [junit4]    >        at 
java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
   [junit4]    >        at 
org.mockito.cglib.core.ReflectUtils$2.run(ReflectUtils.java:57)
   [junit4]    >        at 
java.base/java.security.AccessController.doPrivileged(Native Method)
   [junit4]    >        at 
org.mockito.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:47)
   [junit4]    >        ... 55 more
   [junit4]   2> 64469 INFO  
(SUITE-TestManagedSchemaThreadSafety-seed#[8E654E5E1F32A757]-worker) [    ] 
o.a.s.c.ZkTestServer connecting to 127.0.0.1:51648 51648
   [junit4]   2> 64474 INFO  (Thread-158) [    ] o.a.s.c.ZkTestServer 
connecting to 127.0.0.1:51648 51648
   [junit4]   2> 64478 INFO  
(SUITE-TestManagedSchemaThreadSafety-seed#[8E654E5E1F32A757]-worker) [    ] 
o.a.s.SolrTestCaseJ4 ###deleteCore
   [junit4]   2> NOTE: leaving temporary files on disk at: C:\Users\Uwe 
Schindler\Projects\lucene\trunk-lusolr1\solr\build\solr-core\test\J2\temp\solr.schema.TestManagedSchemaThreadSafety_8E654E5E1F32A757-001
   [junit4]   2> Dez. 26, 2016 8:47:14 NACHM. 
com.carrotsearch.randomizedtesting.ThreadLeakControl checkThreadLeaks
   [junit4]   2> WARNUNG: Will linger awaiting termination of 2 leaked 
thread(s).
   [junit4]   2> NOTE: test params are: codec=Lucene70, 
sim=RandomSimilarity(queryNorm=false): {}, locale=so-KE, timezone=Etc/GMT+4
   [junit4]   2> NOTE: Windows 10 10.0 amd64/Oracle Corporation 9-ea 
(64-bit)/cpus=4,threads=1,free=188820656,total=266338304
   [junit4]   2> NOTE: All tests run in this JVM: [TestRandomFaceting, 
TestCharFilters, BlockJoinFacetSimpleTest, SolrCmdDistributorTest, 
TestTolerantUpdateProcessorRandomCloud, TestManagedSchemaThreadSafety]
   [junit4] Completed [31/670 (1!)] on J2 in 0.83s, 1 test, 1 error <<< 
FAILURES!
{noformat}

> EasyMock/Mockito no longer works with Java 9 b148+
> --------------------------------------------------
>
>                 Key: SOLR-9893
>                 URL: https://issues.apache.org/jira/browse/SOLR-9893
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Tests
>    Affects Versions: 6.x, master (7.0)
>            Reporter: Uwe Schindler
>            Priority: Critical
>
> EasyMock does not work anymore with latest Java 9, because it uses cglib 
> behind that is trying to access a protected method inside the runtime using 
> setAccessible. This is no longer allowed by Java 9.
> Actually this is really stupid. Instead of forcefully making the protected 
> defineClass method available to the outside, it is much more correct to just 
> subclass ClassLoader (like the Lucene expressions module does).
> I tried updating to easymock/mockito, but all that does not work, approx 25 
> tests fail. The only way is to disable all Mocking tests in Java 9. The 
> underlying issue in cglib is still not solved, master's code is here: 
> https://github.com/cglib/cglib/blob/master/cglib/src/main/java/net/sf/cglib/core/ReflectUtils.java#L44-L62
> As we use an old version ock mockito (1.x), a fix is not expected to happen, 
> although cglib might fix this!
> What should we do? This stupid issue prevents us from testing Java 9 with 
> Solr completely! 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to