Java LinkageError when deployed to weblogic

I am working on a large application and I just added a new web service created by eclipse using the axis. The application works fine in my development environment (where the application is located on the pier), but now I am having problems running my application in weblogic (where the application needs to be deployed). The error I am getting is:

java.lang.LinkageError: loader constraint violation in interface
itable initialization: when resolving method
"org.apache.axis.client.Service.getServiceName()Ljavax/xml/namespace/QName;"
the class loader (instance of
weblogic/utils/classloaders/ChangeAwareClassLoader) of the current
class, org/apache/axis/client/Service, and the class loader (instance
of sun/misc/Launcher$AppClassLoader) for interface
javax/xml/rpc/Service have different Class objects for the type
getServiceName used in the signature

This problem has delayed development for several days. As I understand from the search on the Internet:

  • The My Axis dependency contains the class: org.apache.axis.client.Service, which follows the javax.xml.rpc.Service interface.
  • My Weblogic provided an interface: javax.xml.rpc.Service
  • Since they are in a different path (application and weblogic), they are loaded by different class loaders.

1st question: Are my observations correct?

: / ?

:

  • Maven.
  • , , Weblogic, , wlsfullclient.jar ( dev env).
  • - , Axis - .
  • Stack: LinkageErrors Java?.
    • , , : " ".
      • -?
  • , .

EDIT: weblogic.xml :

<?xml version='1.0' encoding='UTF-8'?>
  <weblogic-web-app >
    <container-descriptor>
      <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
  <context-root>auditgui</context-root>
</weblogic-web-app>

WAR :

file.war
    |--crossdomain.xml
    |--robots.txt
    |--META-INF
    |   \--MANIFEST.MF
    |--WEB-INF
    |   |--classes
    |   |   |--com
    |   |   |   \--...
    |   |   |--spring
    |   |   |   |--main-context.xml
    |   |   |   \--security-context.xml
    |   |   \--environment-beans.xml
    |   |--lib
    |   |   \--multiplejars.jar
    |   |--spring
    |   |   |--raw-servlet-context.xml
    |   |   |--root-context.xml
    |   |   \--servlet-context.xml
    |   |--web.xml
    |   \--weblogic.xml
    |--css
    |   \--multipleCSSFiles.css
    |--js
    |   \--multipleJSFiles.js...
    |--img
    |   \--muultipleImages.png...
    \--multipleHTMLFiles.html...
+4
3

, . ;

:

WebLogic--/-

:

prefer-web-inf-classes = true

, , .

:

findjar , jar my QName .

,

mvn :

( , POM ).

, "stax" . "" - ( xmlbeans) genronimo ( ). , geronimo stax - / stax, QName. stax :

    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.5.0</version>
        <!-- Excluding XMLBean STAX because we want to use axiom/geronimo-stax -->
        <exclusions>
            <exclusion>
                <groupId>stax</groupId>
                <artifactId>stax-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

, :)

+3

WebLogic, , WAR weblogic.xml prefer-web-inf-.

<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
+1

WebLogic , , WLS:

<weblogic-web-app>
  <container-descriptor>
    <prefer-application-packages>
      <package-name>org.apache.commons.*</package-name>
      <package-name>org.apache.log4j.*</package-name>
      <package-name>org.slf4j.*</package-name>
    </prefer-application-packages>
  </container-descriptor>
</weblogic-web-app>

prefer-web-inf-classes , , , WebLogic, .

+1
source

Source: https://habr.com/ru/post/1613674/


All Articles