I am working on a big application and I just added a new web service generated by eclipse with the help of axis. The application runs fine in my development environment (where the application is hosted by jetty) but now I am having trouble when 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 issue is delaying development for days already. As I understand from looking on the web:
- My Axis dependency contains the class: org.apache.axis.client.Service which follows the javax.xml.rpc.Service interface.
- My Weblogic provided the interface: javax.xml.rpc.Service
- Since they are in a different path (application and weblogic) they are loaded by different classloaders
1st question: Are my observations correct?
2nd question: What can I do/try to resolve this?
Extra information:
- Using Maven.
- To make sure all dependencies loaded by Weblogic are also available in our development environment we added the wlsfullclient.jar as a dependency (only in our dev env).
- Since our weblogic server is used by a lot of projects I can not just add the Axis jar to the weblogic path.
- I found a similar issue already on Stack: How to deal with LinkageErrors in Java?.
- Their solution is not clear for me though I am interested in Alex Miller's reply, specifically: "That may mean removing it from the classpath and loading as a plugin".
- Does this apply on the application side or is this the web logic side?
- Their solution is not clear for me though I am interested in Alex Miller's reply, specifically: "That may mean removing it from the classpath and loading as a plugin".
- If more information is required I will gladly provide it.
EDIT: I have a weblogic.xml in my project with the following content:
<?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>
The structure of my WAR file is as follows:
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...