3 Replies Latest reply on Sep 8, 2001 4:02 PM by Manuel Alzola

    Jar conflict (jboss/lib)

    Olivier Olivier Newbie


      JDK 1.3.0

      Hi all,

      I've deployed a web application that uses Apache Xalan 2.1.0.
      Thus I put xalan.jar into WEB-INF/lib.

      But when I execute my servlet (opening a JSP), the javax.xml.transform.TransformerFactory class is loaded from jboss/lib/jaxp.jar and not from WEB-INF/lib/xalan.jar (leading at the end to an exception java.lang.ClassNotFoundException: org.apache.xalan.processor.TransformerFactoryImpl).

      The javax.xml.transform package is different in jboss/lib and in xalan 2.1.0 (different versions of JAXP).

      How can I avoid this side-effect (ie, the JSP/servlet container having in its classpath jboss/lib)?



        • 1. Re: Jar conflict (jboss/lib)
          Olivier Olivier Newbie

          The conflict may also come from tomcat/lib/jaxp.jar.

          • 2. Re: Jar conflict (jboss/lib)
            Manuel Alzola Newbie

            The problem is that in Tomcat 3.x you have to put your parsers in the classpath before everything else becouse they are no relying on system properties to decide which parser to use. There is an explanation on how to to this is tomcat´s archives. In Tomcat 4.x the parser loaded by Tomcat for it´s own use does not conflict on the parser used by applications. The problem is solved in last version of JBOSS by using system properties to define which parser to use. I´ll look for the archives and post them later

            • 3. Re: Jar conflict (jboss/lib)
              Manuel Alzola Newbie

              Look at the content of Run.bat in JBOSS/bin

              REM Add the XML parser jars and set the JAXP factory names
              REM Crimson parser JAXP setup(default)
              set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;../lib/crimson.jar
              set JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
              set JAXP=%JAXP% -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl

              If you replace the factory classes for the ones in your favourite parser that should solve the problem. This is the standard way to do it in JAXP

              Manuel Alzola