JBoss not using the deployed Xalan jar

Something that felt like forever to track down…

A test running problem free on the test server was throwing a transformer error locally:

Had IO Exception with stylesheet file: C:\jboss-4.0.3SP1\server\default\conf\documentservice\pmi\include.xslt
at org.apache.xalan.processor.TransformerFactoryImpl.processFromNode(TransformerFactoryImpl.java:126)

On the surface, it looked like there was no difference in the environments; same deployed war file, same JBoss version, same Java version, same everything. Obviously something was different…

Xalan 2.7.0 was distributed in the WEB-INF/lib of the war, but stepping through the code on the failing local server, the byte code didn’t match the attached source. It wasn’t 2.7.0 being used, it was actually the 2.6.0 version shipped with JBoss (found in lib/endorsed).

It turns out that libraries in the lib/endorsed directory are considered system libraries by virtue of being loaded by the System and bootstrap class loaders and as such being used in preference to deployed war files version. (It should be noted that this is an older version of JBoss, namely 4.0.3 SP1.)

That explained why the wrong class was being picked up locally, but not why it worked in the test server environment.

The main difference was that the server was being run as a service on the test server and via a batch file locally.

Purely by chance, the endorsed.dirs parameter had been missed from the configuration of the service wrapper.


Striking this out of the local batch file, sanity returned once more.

rem set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed

Removing Xalan and Xerces from lib\endorsed would have much the same effect and is proposed in this jira task at jboss.org

comments powered by Disqus