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:
1st question: Are my observations correct?
2nd question: What can I do/try to resolve this?
Extra information:
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...
Ok I solved the issue. I found the conflicting dependencies;
Using the
weblogic-web-app/container-descriptor
did not work for me:
prefer-web-inf-classes = true
was already set and changing it to prefer application packages only caused more trouble since the project already depended on the prefer classes configuration.
I used findjar for looking up in which jar's my QName resides and put these jar's in my memory.
Then by using
mvn dependency:tree
I got all the dependencies and sub dependencies of my project (wont post it because the POM is BIG).
I noticed that there were two dependencies with 'stax' in their name. One 'official' stax jar (sub dependency of xmlbeans) and one from genronimo (sub dependency of axiom). So I did some research and found out that the geronimo stax is an implementation/adaption on the original stax jar and therefore both contain QName. I removed the original stax from my dependency list:
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.5.0</version>
<!-- Excluding XMLBean's STAX because we want to use axiom/geronimo-stax -->
<exclusions>
<exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Hope it helps :)