Wednesday 27 August 2008

Update on Weblogic with Tuscany

Wow, it's been a while!

Anyway, I've had a few people mailing me through the Tuscany mailing list to ask Weblogic specific questions, this one comes up most frequently:

java.lang.LinkageError: loader constraints violated when linking
javax/xml/namespace/QName class

Basically, to cut a very very long story short, this is to do with the way Weblogic handles it's ClassLoaders - as this class has already been loaded by the initialisation of the Server in the core ClassLoader it will complain whenever it is attempted to be loaded again from an alternative source which doesn't match the original (if you search the web you'll find a number of references to this!)

So the solution is actually pretty simple - use Weblogic's XML Libraries and parsers. In one of Tuscany 1.3.1 webapps I add the following xml to exclude all of the dependencies that bring in XML libraries:

  <dependency>
   <groupId>org.apache.woden</groupId>
   <artifactId>woden</artifactId>
   <version>1.0-incubating-M7b</version>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>xalan</groupId>
   <artifactId>xalan</artifactId>
   <version>2.7.0</version>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>xerces</groupId>
   <artifactId>xercesImpl</artifactId>
   <version>2.8.1</version>
   <scope>provided</scope>
  </dependency>

  <dependency>
   <groupId>xml-apis</groupId>
   <artifactId>xml-apis</artifactId>
   <version>1.3.03</version>
   <scope>provided</scope>
  </dependency>


Once that's in, you should be ready to go!