Hi,

I bet it’s due to some "core" lib no more in the JDK (for instance, change in 
the JAXB version, missing add module, …).

Maybe the lib loaded by the OSGiLocator are not JDK 11 compliant.

I gonna take a look on your test project, thanks !

Regards
JB

> Le 13 août 2020 à 17:59, Eric Lilja <mindcoo...@gmail.com> a écrit :
> 
> Hello, when attempting to move our existing code base from Java 8 to Java
> 11, we noticed exceptions appearing in the Karaf log in our automated tests
> (using Pax Exam).
> 
> I've made a minimal test project available on github show-casing the issue:
> https://github.com/elilja/java-11-runtime-issue
> 
> Make sure JAVA_HOME is set to Java 11 JDK and simply execute "mvn clean
> test" (we're using Maven 3.6.3 by the way)
> 
> maven.compiler.source/target for this project is currently set java 11
> target, but can be set to java 8, and the issue will still appear if
> using a Java 11 runtime.
> 
> The karaf log can be found under the target folder, where the karaf
> distribution is unpacked, and the exception looks like this:
> 
> $ cat target/38ed3633-4936-4894-9334-0d1849833602/data/log/karaf.log
> aug. 13, 2020 5:36:48 EM org.apache.karaf.main.Main launch
> INFO: Installing and starting initial bundles
> aug. 13, 2020 5:36:49 EM org.apache.karaf.main.Main launch
> INFO: All initial bundles installed and set to start
> aug. 13, 2020 5:36:49 EM org.apache.karaf.main.lock.SimpleFileLock lock
> INFO: Trying to lock
> C:\projects\java-11-runtime-issue\target\38ed3633-4936-4894-9334-0d1849833602\lock
> aug. 13, 2020 5:36:49 EM org.apache.karaf.main.lock.SimpleFileLock lock
> INFO: Lock acquired
> aug. 13, 2020 5:36:49 EM org.apache.karaf.main.Main$KarafLockCallback
> lockAcquired
> INFO: Lock acquired. Setting startlevel to 100
> 2020-08-13T17:36:53,355 | ERROR | features-3-thread-1 | Felix
>             | 5 - org.ops4j.pax.logging.pax-logging-api - 1.11.6 | Bundle
> org.apache.felix.framework [0] EventDispatcher: Error during dispatch.
> (java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator)
> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
>        at
> org.apache.karaf.specs.activator.Activator.register(Activator.java:124)
> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>        at
> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96)
> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>        at
> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
> ~[org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1286)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
> [org.apache.felix.framework-5.6.12.jar:?]
>        at
> org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:244)
> [!/:?]
>        at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1168)
> [!/:?]
>        at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1022)
> [!/:?]
>        at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
> [!/:?]
>        at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
> [!/:?]
>        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> [?:?]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> [?:?]
>        at java.lang.Thread.run(Thread.java:834) [?:?]
> 2020-08-13T17:36:53,377 | ERROR | FelixDispatchQueue | FrameworkEvent
>            | 0 - org.apache.felix.framework - 5.6.12 | FrameworkEvent ERROR
> 
> This exception trace appears several times in the log. It seems to be
> finding an incompatible definition of the OsgiLocator class.
> 
> If I switch back to Java 8, the exception disappears, everything looks fine
> 
> I get the same behavior both under Linux and Windows. On Windows, Oracle
> JDK 11.0.8 was used, on Linux OpenJDK 11.0.8 was used. No difference in
> behavior.
> 
> It happens with older Karaf 4.2.x-versions as well, and I've seen reports
> of this problem on other lists going back to last autumn. With no
> resolution.
> 
> As a side note, we also noticed this reflective access warning, which I
> guess is not related since it's just a warning, but I felt I should share
> it nonetheless:
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by
> org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender
> (file:/C:/projects/java-11-runtime-issue/target/38ed3633-4936-4894-9334-0d1849833602/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
> 
> This warning appears in the test log (the console log) and not the karaf
> log itself and I guess a fix is needed in the Felix framework is needed to
> get rid of it, but it worries me to see the felix framework hasn't made a
> release for 16 months...
> 
> I'm hoping for a fix for this issue for the upcoming Karaf 4.2.10 (but,
> yes, I am only speculating here the problem lies in Karaf or one of its
> dependencies)!
> 
> - Eric L

Reply via email to