You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Soefara Redzuan <so...@hotmail.com> on 2002/09/12 19:20:38 UTC

Running XML-parsing servlets on Tomcat, using JAXP ?

Has anybody managed to run XML-parsing servlets on Tomcat 4 using JAXP?
If so, could you please help me with the XML configuration for
Tomcat because I keep getting class clashes. Here's what I've done
so far,

1. Downloaded the Java XML Pack from
   http://java.sun.com/xml/javaxmlpack.html

2. Unpacked the Java XML Pack and put the JAXP jar files (dom.jar,
   jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar)
   in the directory c:\jdk1.3\jaxp-1.2_01

3. Added all the jars to the CLASSPATH

4. The Java XML Pack instructions then read,

   > When you run the examples on Tomcat you must copy all
   > the JAR files from the Java XML Pack to CATALINA_HOME/common/lib .
   > Some of these files already exist in Tomcat distribution and
   > should be overwritten by the Java XML Pack JARs. The xerces.jar
   > that comes with the tomcat installation should also be removed
   > from CATALINA_HOME/common/lib.

   I copied all of the JAXP jar files (dom.jar, jaxp-api.jar,
   sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) to
   CATALINA_HOME/common/lib but strangely none of them existed
   there previously ! Also, there was no "xerces.jar" that
   supposedly came with the Tomcat distribution according to the
   Sun documentation.
   There is however, a crimson.jar (I'm using an early Tomcat4.x)
   and a jaxp.jar which I removed, since JAXP's jaxp-api.jar
   seems to contain updated libraries.

5. I restarted Tomcat and then tried to run a servlet which
   uses some XML-parsing, which I have already tested in a
   standalone command-line program and found to be working OK.

   However, the servlet generated this error,
   "java.lang.LinkageError: loader constraints violated when linking
    org/xml/sax/InputSource class"

   which I believe means that the Tomcat class loader is finding
   two conflicting org.xml.sax.InputSource classes (and possibly
   associated libraries).

This was my big worry with adding XML libraries to my operating
system, that they would clash with Tomcat's to stop functioning.
How should I have arranged things to make this work ?

I put all the JAXP libraries in c:\jdk1.3\jaxp-1.2_01 and added
them to the CLASSPATH so that I can easily compile all XML programs
without defining where to find the Sax libraries and classes,
because my XML applications are not just for Tomcat.

Thank you so much for any help.

Soefara.




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Running XML-parsing servlets on Tomcat, using JAXP ?

Posted by Jean-Francois Arcand <jf...@apache.org>.
You don't need the jax-pack for your problem. Under 
{CATALINA_HOME}/common/endorsed, just copy the xerces.jar and the 
jaxp-ri.jar file. Tomcat will uses this folder for selecting which 
parser to use (so crimson will not be used).

-- Jeanfrancois

Soefara Redzuan wrote:

> Has anybody managed to run XML-parsing servlets on Tomcat 4 using JAXP?
> If so, could you please help me with the XML configuration for
> Tomcat because I keep getting class clashes. Here's what I've done
> so far,
>
> 1. Downloaded the Java XML Pack from
> http://java.sun.com/xml/javaxmlpack.html
>
> 2. Unpacked the Java XML Pack and put the JAXP jar files (dom.jar,
> jaxp-api.jar, sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar)
> in the directory c:\jdk1.3\jaxp-1.2_01
>
> 3. Added all the jars to the CLASSPATH
>
> 4. The Java XML Pack instructions then read,
>
> > When you run the examples on Tomcat you must copy all
> > the JAR files from the Java XML Pack to CATALINA_HOME/common/lib .
> > Some of these files already exist in Tomcat distribution and
> > should be overwritten by the Java XML Pack JARs. The xerces.jar
> > that comes with the tomcat installation should also be removed
> > from CATALINA_HOME/common/lib.
>
> I copied all of the JAXP jar files (dom.jar, jaxp-api.jar,
> sax.jar, xalan.jar, xercesImpl.jar and xsltc.jar) to
> CATALINA_HOME/common/lib but strangely none of them existed
> there previously ! Also, there was no "xerces.jar" that
> supposedly came with the Tomcat distribution according to the
> Sun documentation.
> There is however, a crimson.jar (I'm using an early Tomcat4.x)
> and a jaxp.jar which I removed, since JAXP's jaxp-api.jar
> seems to contain updated libraries.
>
> 5. I restarted Tomcat and then tried to run a servlet which
> uses some XML-parsing, which I have already tested in a
> standalone command-line program and found to be working OK.
>
> However, the servlet generated this error,
> "java.lang.LinkageError: loader constraints violated when linking
> org/xml/sax/InputSource class"
>
> which I believe means that the Tomcat class loader is finding
> two conflicting org.xml.sax.InputSource classes (and possibly
> associated libraries).
>
> This was my big worry with adding XML libraries to my operating
> system, that they would clash with Tomcat's to stop functioning.
> How should I have arranged things to make this work ?
>
> I put all the JAXP libraries in c:\jdk1.3\jaxp-1.2_01 and added
> them to the CLASSPATH so that I can easily compile all XML programs
> without defining where to find the Sax libraries and classes,
> because my XML applications are not just for Tomcat.
>
> Thank you so much for any help.
>
> Soefara.
>
>
>
>
> _________________________________________________________________
> Join the worlds largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
>
>
> --
> To unsubscribe, e-mail: 
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>