QName problem with BEA WebLogic Server (WLS) 8.1

One day I was looking for a fast and easy to use Java webservice implementation. I found XFire, the next gen java SOAP framework which is based on a low memory StAX model. There’s a FAQ on the XFire website about how to run XFire in a WebLogic environment. XFire requires a newer version of the javax.xml.namespace.QName than is included in weblogic.jar. Now, this cures the problem with the missing constructor. Depending on what exactly you do in your webservice other errors may occur. The most prominent exception being this one:

loader constraints violated when linking

The problem occurs if there’s the combination of an older version of QName (being loaded from the application server at boot time) and a library which uses the 3-string constructor introduced in a later version of QName. This most likely is a class loading issue because the QName class in weblogic.jar is loaded earlier by the system classloader and can’t be “overridden” by the EAR/WAR classloader. But that’s just my best bet as I am not a classloader expert when it comes to WebLogic’s classloading mechanism.

This is neither an XFire-only problem nor is it a WebLogic-only problem! I read about XML libraries (eg. XMLBeans, Spring, Muse) having the same issues with QName if running in an application server environment (e.g. IBM Websphere). Continue reading “QName problem with BEA WebLogic Server (WLS) 8.1”