Version 24

    How To Use JAXP 1.3 with JBoss 4.0.2 (Work In Progress)

     

    Motivation

    Code that heavily relies on DOM L3 won't run with the default settings of JBoss 4.0.2 because of the bugs in its (quite old) endorsed parser. DOM L3 works just fine with the JAXP 1.3 parser that comes with Java 5.0, however using that parser is not exactly a piece of cake, and we will show you a way how it can be done.

     

    WARNING

    This information is more about how to change the JAXP implementation in your JDK.

    This is allowed under the spec/license but you need to test it thoroughly.

     

    Summary

    • Download and install Java 5.0

    • Download and install JBossAS 4.0.2

    • Modify the JBoss startup scripts

    • Modify your code

     

    Download and install Java 5.0

    If you don't have Java 5.0 installed download the JRE or the JDK and install it on your machine .

     

    Download and install JBossAS 4.0.2

    If you don't have JBossAS 4.0.2 installed download it and install it.

     

    Note: We have actually tried this with JBoss 4.0.1 and 4.0.2, and there is no reason why it should not run with older JBoss versions as well.

     

    Modify the JBoss startup script

     

    This section is if you want everything using your JDK/JRE installation to use the updated JAXP/Xerces.

    More likely, you probably just want to replace the lib/endorsed jars such it only affects this

    installation of JBoss?

     

    • Get rid of the endorsing mechanism (just remove -Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%)

    • Add all the jars in the ./lib/endorsed to the classpath

    • Add %JAVA_HOME%\jre\lib\rt.jar to the classpath

     

    See the attached run-jaxp13.bat on how this can be done.

     

    Modify your code

    Modify your code, so that if you are using the more portable way to get a DOM implemetation:

     

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation domImpl = builder.getDOMImplementation();

     

     

    Replace it with the less portable (yes, you have to do it, otherwise you will get the same DOM implementation used by JBoss, and you don't want that):

     

    DOMImplementation domImpl = (DOMImplementation)com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl.getDOMImplementation();

     

    Future JBoss versions

    The good news is that JBoss 4.0.3RC2 has been updated to use Xerces-J 2.7, which should fix many of the problems that crippled the endorsed parser. And according to the release notes, Xerces-J 2.7 provides a complete implementation of the parser related portions of JAXP 1.3. Well, we were unable to check it out yet (JBoss 4.0.3RC1 doesn't contain this change yet) but when released it should fix the problems.