Closed graben closed 3 years ago
Thanks for finding this. I see Karaf doesn't add javax.security.cert
to org.osgi.framework.bootdelegation
...
Do you think it's more a Karaf bug?
I'm just running pax-transx tests on JDK11 and they hang at org.ops4j.pax.transx.itests.NarayanaRecoveryTest
- may be on my side, but let me check further.
javax.security.cert
should rather be explicitly imported - I wonder why only on JDK11 and why it wasn't caught by maven-bundle-plugin
JDK8 tests pass:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.ops4j.pax.transx.itests.AtomikosRecoveryTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.595 s - in org.ops4j.pax.transx.itests.AtomikosRecoveryTest
[INFO] Running org.ops4j.pax.transx.itests.AtomikosTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.956 s - in org.ops4j.pax.transx.itests.AtomikosTest
[INFO] Running org.ops4j.pax.transx.itests.GenericConnectionManagerTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.683 s - in org.ops4j.pax.transx.itests.GenericConnectionManagerTest
[INFO] Running org.ops4j.pax.transx.itests.GeronimoRecoveryTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.865 s - in org.ops4j.pax.transx.itests.GeronimoRecoveryTest
[INFO] Running org.ops4j.pax.transx.itests.GeronimoTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.931 s - in org.ops4j.pax.transx.itests.GeronimoTest
[INFO] Running org.ops4j.pax.transx.itests.NarayanaRecoveryTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.848 s - in org.ops4j.pax.transx.itests.NarayanaRecoveryTest
[INFO] Running org.ops4j.pax.transx.itests.NarayanaTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.725 s - in org.ops4j.pax.transx.itests.NarayanaTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
I'm just running pax-transx tests on JDK11 and they hang at
org.ops4j.pax.transx.itests.NarayanaRecoveryTest
- may be on my side, but let me check further.
Yes I had the same problem. Have a look into org.ops4j.pax.transx\pax-transx-itests\target\surefire-reports\org.ops4j.pax.transx.itests.NarayanaRecoveryTest-output.txt its weird JDK stuff :)
Here's the problem:
java.lang.NoClassDefFoundError: jdk/internal/reflect/ConstructorAccessorImpl
at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method)
at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1194)
at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:400)
at java.base/jdk.internal.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/jdk.internal.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at java.base/jdk.internal.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1022)
at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1008)
at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:306)
at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:304)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:304)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:294)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
at java.base/java.lang.reflect.Field.declaredAnnotations(Field.java:1175)
at java.base/java.lang.reflect.Field.declaredAnnotations(Field.java:1173)
at java.base/java.lang.reflect.Field.getAnnotation(Field.java:1142)
at java.base/java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:274)
at java.base/java.lang.reflect.AccessibleObject.isAnnotationPresent(AccessibleObject.java:517)
at com.arjuna.common.internal.util.propertyservice.BeanPopulator.configureFromProperties(BeanPopulator.java:169)
at com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(BeanPopulator.java:87)
at com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(BeanPopulator.java:66)
at com.arjuna.ats.arjuna.objectstore.StoreManager.initStore(StoreManager.java:146)
at com.arjuna.ats.arjuna.objectstore.StoreManager.getActionStore(StoreManager.java:111)
at com.arjuna.ats.arjuna.objectstore.StoreManager.getRecoveryStore(StoreManager.java:68)
at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.<init>(AtomicActionRecoveryModule.java:67)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClass(ClassloadingUtility.java:135)
at com.arjuna.common.internal.util.ClassloadingUtility.loadAndInstantiateClassesWithInit(ClassloadingUtility.java:192)
at com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.getRecoveryModules(RecoveryEnvironmentBean.java:465)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.loadModules(PeriodicRecovery.java:888)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.<init>(PeriodicRecovery.java:121)
at com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple.<init>(RecoveryManagerImple.java:107)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.<init>(RecoveryManager.java:481)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:132)
at com.arjuna.ats.arjuna.recovery.RecoveryManager.manager(RecoveryManager.java:112)
at com.arjuna.ats.jbossatx.jta.RecoveryManagerService.create(RecoveryManagerService.java:54)
at org.jboss.narayana.osgi.jta.internal.OsgiServer.doStart(OsgiServer.java:89)
at org.jboss.narayana.osgi.jta.internal.OsgiServer.start(OsgiServer.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.narayana.osgi.jta.internal.Activator.doStart(Activator.java:49)
at org.ops4j.pax.transx.tm.impl.AbstractActivator.run(AbstractActivator.java:115)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
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)
Caused by: java.lang.ClassNotFoundException: jdk.internal.reflect.ConstructorAccessorImpl
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 60 more
Hmm, netty-common has proper import of javax.security.cert;resolution:=optional
. I see that pax-transx-tm-narayana activator creates some magical classloader, but it doesn't look like JDK dependent...
@graben from the stack trace fragment:
Caused by: java.lang.ClassNotFoundException: javax.security.cert.X509Certificate
at java.net.URLClassLoader.findClass(URLClassLoader.java:471) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
at io.netty.util.internal.EmptyArrays.<clinit>(EmptyArrays.java:38) ~[netty-common-4.1.48.Final.jar:4.1.48.Final]
it looks like exactly this class loader is used: https://github.com/ops4j/org.ops4j.pax.transx/blob/pax-transx-0.5.0/pax-transx-tm-narayana/src/main/java/org/jboss/narayana/osgi/jta/internal/Activator.java#L87-L97 - I'll try to reproduce it tomorrow, ok?
What do you expect? It's working with my small patch #51, but maybe a better solution could be found. I have no pressure at the moment. :)
I'm rather worried that there may be other missing packages ;)
And because netty-common has this import, javax.security.cert.X509Certificate
should be loaded through netty-common's BundleClassLoader
I added a simple test to pax-transx-tm-narayana to check the imports of the bundles that are embedded inside pax-transx-tm-narayana and are used within special ClassLoader. Then I removed these imports, which are satisfied by the exports of the embedded bundles.
The result is:
= netty-handler-4.1.48.Final.jar
Import-Package
- io.netty.internal.tcnative;resolution:=optional
- javax.crypto
- javax.crypto.spec
- javax.net.ssl
- javax.security.auth.x500
- javax.security.cert
- org.bouncycastle.asn1.x500;resolution:=optional
- org.bouncycastle.cert;resolution:=optional
- org.bouncycastle.cert.jcajce;resolution:=optional
- org.bouncycastle.jce.provider;resolution:=optional
- org.bouncycastle.operator;resolution:=optional
- org.bouncycastle.operator.jcajce;resolution:=optional
- org.conscrypt;resolution:=optional
- org.eclipse.jetty.alpn;resolution:=optional
- org.eclipse.jetty.npn;resolution:=optional
- sun.nio.ch;resolution:=optional
- sun.security.util;resolution:=optional
- sun.security.x509;resolution:=optional
= jtax-5.10.6.Final.jar
Import-Package
= netty-codec-4.1.48.Final.jar
Import-Package
- com.google.protobuf;resolution:=optional
- com.google.protobuf.nano;resolution:=optional
- com.jcraft.jzlib;resolution:=optional
- com.ning.compress;resolution:=optional
- com.ning.compress.lzf;resolution:=optional
- com.ning.compress.lzf.util;resolution:=optional
- lzma.sdk;resolution:=optional
- lzma.sdk.lzma;resolution:=optional
- net.jpountz.lz4;resolution:=optional
- net.jpountz.xxhash;resolution:=optional
- org.eclipse.jetty.alpn;resolution:=optional
- org.eclipse.jetty.npn;resolution:=optional
- org.jboss.marshalling;resolution:=optional
- sun.nio.ch;resolution:=optional
= netty-common-4.1.48.Final.jar
Import-Package
- com.oracle.svm.core.annotate;resolution:=optional
- javax.security.cert;resolution:=optional
- org.apache.commons.logging;resolution:=optional
- org.apache.log4j;resolution:=optional
- org.apache.logging.log4j;resolution:=optional
- org.apache.logging.log4j.message;resolution:=optional
- org.apache.logging.log4j.spi;resolution:=optional
- org.slf4j;resolution:=optional
- org.slf4j.helpers;resolution:=optional
- org.slf4j.spi;resolution:=optional
- reactor.blockhound;resolution:=optional
- reactor.blockhound.integration;resolution:=optional
- sun.misc;resolution:=optional
= artemis-commons-2.14.0.jar
Import-Package
= activemq-artemis-native-1.0.2.jar
Import-Package
= artemis-journal-2.14.0.jar
Import-Package
= netty-transport-4.1.48.Final.jar
Import-Package
- org.eclipse.jetty.alpn;resolution:=optional
- org.eclipse.jetty.npn;resolution:=optional
- sun.nio.ch;resolution:=optional
= jboss-logging-3.2.1.Final.jar
Import-Package
- org.apache.log4j;resolution:=optional
- org.apache.logging.log4j;resolution:=optional
- org.apache.logging.log4j.message
- org.apache.logging.log4j.spi
- org.jboss.logmanager;resolution:=optional
- org.slf4j;resolution:=optional
- org.slf4j.spi;resolution:=optional
= jta-5.10.6.Final.jar
Import-Package
= arjuna-5.10.6.Final.jar
Import-Package
= common-5.10.6.Final.jar
Import-Package
= netty-buffer-4.1.48.Final.jar
Import-Package
- org.eclipse.jetty.alpn;resolution:=optional
- org.eclipse.jetty.npn;resolution:=optional
- sun.nio.ch;resolution:=optional
= orbportability-5.10.6.Final.jar
Import-Package
= narayana-jts-integration-5.10.6.Final.jar
Import-Package
= netty-resolver-4.1.48.Final.jar
Import-Package
- org.eclipse.jetty.alpn;resolution:=optional
- org.eclipse.jetty.npn;resolution:=optional
- sun.nio.ch;resolution:=optional
I'll add relevant imports to pax-transx-tm-narayana itself
Tests pass in JDK8 and JDK11.
@grgrzybek : Time to release 0.5.1?
sure - let me do it on Monday, ok? And sorry for the delay ;)
I can do it during Week end if you want. Just let me know.
Monday is fine :-)
I'm just releasing pax-transx 0.5.1
pax-transx-tm-narayana needs explicit import for javax.security.cert to get used under JDK 11. It's usable with JDK 8 even without import.