Karaf never comes up with Java 11 and PAX-EXAM 4.13.1

597 views Asked by At

Trying to update a Karaf based application to Java 11. The Pax Exam tests are broken and I don't see the cause. Below is the stack trace. Can one of you OSGi gurus tell me how to fix this?

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender (file:/projects/reflex-wps/itests/itests-wps/target/exam/acd907f2-8a4a-4ac3-8014-be93bb82e439/system/org/apache/felix/org.apache.felix.framework/5.6.12/org.apache.felix.framework-5.6.12.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 180.625 sec <<< FAILURE! - in org.codice.wps.itests.ClientFeatureIntegrationTest
org.codice.wps.itests.ClientFeatureIntegrationTest  Time elapsed: 180.576 sec  <<< ERROR!
java.lang.RuntimeException: Cannot get the remote bundle context
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:261)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:218)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:659)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.startKaraf(KarafTestContainer.java:262)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:194)
    at org.ops4j.pax.exam.spi.reactors.SingletonStagedReactor.beforeSuite(SingletonStagedReactor.java:128)
    at org.ops4j.pax.exam.spi.reactors.PerSuiteStagedReactor.beforeSuite(PerSuiteStagedReactor.java:72)
    at org.ops4j.pax.exam.spi.reactors.ReactorManager.beforeClass(ReactorManager.java:455)
    at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:97)
    at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.rmi.NotBoundException: cd7e16b9-fb73-4a78-b9d4-ac18c7fdc792
    at java.rmi/sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:234)
    at java.rmi/sun.rmi.registry.RegistryImpl_Skel.dispatch(RegistryImpl_Skel.java:133)
    at java.rmi/sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:468)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:298)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
    at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
    at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
    at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:380)
    at java.rmi/sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:123)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:248)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:218)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:659)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.startKaraf(KarafTestContainer.java:262)
    at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:194)
    at org.ops4j.pax.exam.spi.reactors.SingletonStagedReactor.beforeSuite(SingletonStagedReactor.java:128)
    at org.ops4j.pax.exam.spi.reactors.PerSuiteStagedReactor.beforeSuite(PerSuiteStagedReactor.java:72)
    at org.ops4j.pax.exam.spi.reactors.ReactorManager.beforeClass(ReactorManager.java:455)
    at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:97)
    at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Java - openjdk version "11.0.10"

Karaf - 4.2.6

Pax Exam - 4.13.1

1

There are 1 answers

1
ahoffer On

The solution was to pass additional JVM arguments to the Pax Exam configuration. Below is a link to a long list of VM options one project used to get Pax Exam running in the JRE11. I copied and pasted them all. Now the integration tests run correctly on JRE11. However, the integration tests cannot be run in JRE8. The Java 8 JVM does not understand all of the arguments (some are specific to later verssion of the JVM). The JRE8 simply crashes.

See:

https://github.com/codice/ddf/blob/6ad716e4e4be6cdad64fa1c7df6d9890a8b07385/distribution/test/itests/test-itests-common/src/main/java/org/codice/ddf/itests/common/AbstractIntegrationTest.java#L669