Hi, Stefano. A few items:
- What fixpack did you move from? There was a fairly substantial recent update to CXF in Liberty, and it would be good to know whether that's relevant here.
- Along the same lines, can you share the stack trace of the error (you can anonymize any of your own classes)? That would help us correlate the error to wherever it's occurring in Liberty/CXF or your application.
- All that said, the simplest answer, if you're intending to provide your own version of CXF, would be to remove the JAX-WS and JAX-RS features from your server.xml. If you don't intend to use the server's copies of these APIs, leaving them out greatly simplifies the class loading and makes it much less likely that you'll hit an issue like this - LinkageErrors like this are are only possible if there's more than one version of something in the JVM.
------------------------------
Jarid Kvale
------------------------------
Original Message:
Sent: Tue January 10, 2023 06:55 PM
From: Stefano Mastrella
Subject: application raise LinkageError after updating to v22
Hi all,
We've just updated the WAS Liberty installation to the latest one (v22)
> openliberty.properties:
> ...
> com.ibm.websphere.productVersion=22.0.0.13
and at the start of the application we get a LinkageError
java.lang.LinkageError: loading constraint violation: loader
"com/ibm/ws/classloading/internal/AppClassLoader@ef7a3b9f"
previously initiated loading for a different type with name
"org/apache/cxf/common/util/ModCountCopyOnWriteArrayList"
defined by loader
"org/eclipse/osgi/internal/loader/EquinoxClassLoader@bf250f42"
with the verbose logging of the JVM we see the class is loaded from
class load: org.apache.cxf.common.util.ModCountCopyOnWriteArrayList from: file:/prod/IBM/WebSphere/wlp/lib/com.ibm.ws.org.apache.cxf.cxf.core.3.2_1.0.69.jar
we have a strange thing: what we see in the jar is not what I want my app has as dependency.
My app rely on the version 3.0.12 of the cxf library
mvn dependency:tree -Dincludes=org.apache.cxf
...
[INFO] it.finanze.adm:BDA-BE:war:0.0.1-SNAPSHOT
[INFO] \- org.apache.cxf:cxf-core:jar:3.0.12:compile
So the question is: how to overcome this Error?
------------------------------
Stefano Mastrella
------------------------------