You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Voegele, Jason" <Ja...@us.origin-it.com> on 2000/11/10 00:21:42 UTC

Problems with Tomcat and XML4J/Xerces

I'm using Tomcat 1.3.14 on Windows NT Server 4.0 (SP6a).  I'm trying to use
IBM's XML4J/Xerces XML parser and experiencing some difficulty.

We're trying to use the DOM (Level 2) API for parsing some XML.  This works
perfectly fine when invoked from the command line.

We have tried to invoke it from a JSP using Tomcat, but this causes an
"IllegalStateException" to be thrown.  The stack trace that appears in the
Tomcat console window state that there was a "NoSuchMethodError" when my
code tries to invoke the "getElementById" method on a DOM Document.

All the necessary JAR files for XML4J are in the WEB-INF\lib directory.  My
feeling is that there is a conflict between the XML parser included with
Tomcat (Sun's) and the XML4J parser.  I tried removing Tomcat's xml.jar file
from the lib directory, but Tomcat cannot start without the xml.jar file.
Is there a way to ensure that the DOM Document I'm using is the version
supplied with IBM's parser?  In other words, how can I ensure that my
WEB-INF\lib\*.jar files are searched before TOMCAT_HOME\lib\*.jar files?  Or
is there another solution?

Thanks for your help,
Jason Voegele


Re: Problems with Tomcat and XML4J/Xerces

Posted by Jeremy Howard <je...@flashcom.net>.
Problems with Tomcat and XML4J/XercesJason,

I had the same problem with Tomcat's xml.jar and JDOM's xml parser (www.jdom.org) which is also based on Xerces.  What I ended up doing was jar'ing the two jar files together.  I know its not pretty but it did work.  I hope this helps.

Jeremy Howard
jeremyh@flashcom.net  
  ----- Original Message ----- 
  From: Voegele, Jason 
  To: 'tomcat-user@jakarta.apache.org' 
  Sent: Thursday, November 09, 2000 3:21 PM
  Subject: Problems with Tomcat and XML4J/Xerces


  I'm using Tomcat 1.3.14 on Windows NT Server 4.0 (SP6a).  I'm trying to use IBM's XML4J/Xerces XML parser and experiencing some difficulty.

  We're trying to use the DOM (Level 2) API for parsing some XML.  This works perfectly fine when invoked from the command line.

  We have tried to invoke it from a JSP using Tomcat, but this causes an "IllegalStateException" to be thrown.  The stack trace that appears in the Tomcat console window state that there was a "NoSuchMethodError" when my code tries to invoke the "getElementById" method on a DOM Document.

  All the necessary JAR files for XML4J are in the WEB-INF\lib directory.  My feeling is that there is a conflict between the XML parser included with Tomcat (Sun's) and the XML4J parser.  I tried removing Tomcat's xml.jar file from the lib directory, but Tomcat cannot start without the xml.jar file.  Is there a way to ensure that the DOM Document I'm using is the version supplied with IBM's parser?  In other words, how can I ensure that my WEB-INF\lib\*.jar files are searched before TOMCAT_HOME\lib\*.jar files?  Or is there another solution?

  Thanks for your help, 
  Jason Voegele