Tuesday, April 5, 2011

java.lang.LinkageError in Weblogic

Yesterday I deployed a webservice which had been built by a third party on our Weblogic server.
This went fairly well apart from a few minor issues and everything was up and running faster than I'd anticipated.
After the application server and application had started I entered the endpoint URL which worked just fine, next step was to retrieve the WSDL so I could create a few simple test requests with SoapUI.
Retrieving the WSDL resulted in an error page displaying an all too familiair exception:
java.lang.LinkageError: Class javax/xml/namespace/QName violates loader constraints

I'm sure we all now about it by now but in case we don't: don't package API classes if you don't have to, as different versions are usually already on the application server classpath resulting in the exception mentioned above.

Nine out of ten times these API jars "accidentally" end up in your war/ear as they're pulled in as a Maven dependency so I make a habit of checking the war/ear from time to time (when dependencies have been added) and excluding any unwanted API jars.

In this case it turned out a version of xpp was being used that packaged this particular class, bumping up the version number solved the problem.

0 comments:

Post a Comment