WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  application raise LinkageError after updating to v22

    Posted Wed January 11, 2023 09:06 AM

    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
    ------------------------------


  • 2.  RE: application raise LinkageError after updating to v22

    Posted Tue January 17, 2023 10:49 AM
    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
    ------------------------------



  • 3.  RE: application raise LinkageError after updating to v22

    Posted Wed August 30, 2023 09:08 AM
    Edited by Gabriel Marte Blanco Wed August 30, 2023 02:36 PM

    Having similar problem with Liberty
    Product name: WebSphere Application Server
    Product version: 23.0.0.8
    Product edition: BASE_ILAN
    When starting Java17 camel service with CXF Client

    Caused by: java.lang.IllegalArgumentException: org.apache.cxf.endpoint.Client referenced from a method is not visible from class loader

    at java.base/java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:883) ~[?:?]

    at java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:721) ~[?:?]

    at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:648) ~[?:?]

    at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:440) ~[?:?]



    ------------------------------
    Bryan McLane
    ------------------------------