Description of problem: Running a SOAP client QName is loaded from xmlpull.jar and JVM rt.jar leading to Caught: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/ejbca/core/protocol/ws/client/gen/EjbcaWSService, and the class loader (instance of <bootloader>) for the method's defining class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/ejbca/core/protocol/ws/client/gen/EjbcaWSService, and the class loader (instance of <bootloader>) for the method's defining class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature at org.ejbca.core.protocol.ws.client.gen.EjbcaWSService.<init>(EjbcaWSService.java:37) at com.example.ejbca.version.run(version.groovy:73) Version-Release number of selected component (if applicable): 2.4.4 How reproducible: Always Steps to Reproduce: 1. Run groovy script using EJBCA SOAP service Name qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService") def ejbcasvc = new EjbcaWSService(new URL("https://example.com/ejbca/ejbcaws/ejbcaws?wsdl"), qname) def ejbcaws = ejbcasvc.getEjbcaWSPort() logger.info("Connected to EJBCA version: " + Ejbca.getVersion(ejbcaws)) 2. The SOAP service is from https://www.ejbca.org/ 3. Actual results: Caught: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/ejbca/core/protocol/ws/client/gen/EjbcaWSService, and the class loader (instance of <bootloader>) for the method's defining class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/ejbca/core/protocol/ws/client/gen/EjbcaWSService, and the class loader (instance of <bootloader>) for the method's defining class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature at org.ejbca.core.protocol.ws.client.gen.EjbcaWSService.<init>(EjbcaWSService.java:37) Expected results: [main] INFO ejbca - Connected to EJBCA version: EJBCA 6.3.1.1 Community (r21429) Additional info: Upstream groovy-2.4.5 has xmlpull-1.1.3.1.jar. Not sure why that works but Fedora groovy doesn't. Fedora 2.4.4: (with -verbose) [Loaded javax.xml.namespace.QName from file:/usr/share/groovy/lib/xmlpull.jar] [Loaded javax.xml.namespace.QName from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-4.b17.fc23.x86_64/jre/lib/rt.jar] Caught: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, org/ejbca/core/protocol/ws/client/gen/EjbcaWSService, and the class loader (instance of <bootloader>) for the method's defining class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature Upstream 2.4.5: (-verbose) [Loaded javax.xml.namespace.QName from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-4.b17.fc23.x86_64/jre/lib/rt.jar] [Loaded javax.xml.namespace.QName$1 from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-4.b17.fc23.x86_64/jre/lib/rt.jar] Why upstream doesn't pull in its own groovy-2.4.5/lib/pull-1.1.3.1.jar and have the same error?
Can reproduce the error on RHEL 7. groovy 1.8
Same issue if I set JAVA_HOME to Oracle JDK. The issue may be the Fedora wrapper scripts. With Oracle JDK: [Loaded javax.xml.namespace.QName from file:/usr/share/groovy/lib/xmlpull.jar] [Loaded javax.xml.namespace.QName from /opt/java/jdk1.8.0_60/jre/lib/rt.jar] Caught: java.lang.LinkageError: loader constraint violation:
A "hotfix" is to remove the link from /usr/share/groovy/xmlpull.jar to /usr/share/java/xpp3.jar OR link it to upstream's groovy-2.4.5/lib/xmlpull-1.1.3.1.jar. I have verified that this works. Maybe a bug in xpp3? It should not bundle javax/xml/namespace/QName.class
This may actually be a bug in xpp3.jar (not sure why it bundles QName). I have filed 1299679.
Not a bug in xpp3 either: maybe groovy should link to xpp3_min /usr/share/groovy/xmlpull.jar -> /usr/share/java/xpp3_min.jar instead of /usr/share/java/xpp3.jar. This is what upstream seems to do: its xmlpull.jar looks more like xpp3_min.jar instead of xpp3.jar.
On Fedora should be xpp3-minimal.jar ln -fs /usr/share/java/xpp3-minimal.jar /usr/share/groovy/xmlpull.jar
Thanks for the bug report Richard, and thanks for your analysis of the problem. You're right, the symlink should point to "minimal" version of the xpp3 library.
groovy-2.4.4-3.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d814445cea
groovy-2.4.4-3.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-d814445cea
groovy-2.4.4-3.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.