This content has been marked as final. Show 5 replies
The LinkageError typically happens when two classloaders (parent-child) load different versions of the same class. This is a side effect of turning on prefer-web-inf-classes as it changes the classloader delegation. From your email its not clear what jars you have in the webapp. I would recommend that you turn off prefer-web-inf-classes if possible. If not, you will have to look at all the jars in your webapp and ensure that they dont conflict with the ones in the system classpath
Thanks for the reply.
I found out the conflicting jar file.
I am using Axis2 v1.3, so my WEB-INF/lib has wsdl4j-1.6.2.jar and <DOMAIN>/lib has a wsdl4j-1.51.jar (some other app is using it).
One thing I don't understand is that with "<prefer-web-inf-classes>" being true, my app class loader should load my version of wsdl jar instead of asking the parent class loader (system classpath classloader) to load that wsdl jar in <DOMAIN>/lib.
Please correct me if I am wrong on my understanding on how Weblogic class loader works.
It could be that your app is attempting to load a class which is only visible to the system classloader. Now if this class references any classes in your wsdl*.jar those classes will also be loaded by the system classloader instead. And hence the version mismatch
Trying to resolve the problem:
Now, <DOMAIN>/lib/ only has "wsdl4j-1.6.2.jar".
This is the same jar in my web service's WAR file. (i.e. WEB-INF/lib)
When accessing my webservice, I still got the "LinkageError: loader constraints violated when linking org/xml/sax/InputSource class" error.
If I remove the wsdl jar file from <DOMAIN>/lib, my web service is working fine.
I have trouble understanding what causes the error.
Anyone has an explanation.
Thanks in advance