Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-12092

Build fails with Java 11

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • JCR Resource 3.2.4
    • JCR Resource 3.2.6
    • JCR
    • None

    Description

      From https://ci-builds.apache.org/blue/rest/organizations/jenkins/pipelines/Sling/pipelines/modules/pipelines/sling-org-apache-sling-jcr-resource/branches/master/runs/216/nodes/60/steps/105/log/?start=0:

      [ERROR] org.apache.sling.jcr.resource.internal.JcrResourceListenerTest.testSimpleOperations  Time elapsed: 0.095 s  <<< ERROR!
      java.lang.ExceptionInInitializerError
      	at org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
      	at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
      	at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
      	at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
      	at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
      	at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
      	at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
      	at org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
      	at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:85)
      	at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:62)
      	at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:56)
      	at org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
      	at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
      	at org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
      	at org.mockito.Mockito.mock(Mockito.java:1243)
      	at org.mockito.Mockito.mock(Mockito.java:1120)
      	at org.apache.sling.jcr.resource.internal.helper.jcr.SlingRepositoryProvider.getFakeContext(SlingRepositoryProvider.java:56)
      	at org.apache.sling.jcr.resource.internal.helper.jcr.SlingRepositoryProvider.getRepository(SlingRepositoryProvider.java:41)
      	at org.apache.sling.jcr.resource.internal.JcrResourceListenerTest.setUp(JcrResourceListenerTest.java:74)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
      	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
      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 @1880a322
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
      	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
      	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
      	at org.mockito.cglib.core.ReflectUtils$2.run(ReflectUtils.java:57)
      	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
      	at org.mockito.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:47)
      	... 49 more
      

      It requires an update to a newer Mockito (https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=255071690#CommonIssueswhenbuildingwithnewerJDKs(11or17)-TestfailureswhentryingtoinstrumentclasseswithMockito)

      Attachments

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: