[jdom-interest] Tomcat and JDOM compatability

Laurent Bihanic laurent.bihanic at atosorigin.com
Fri Nov 9 00:46:15 PST 2001


Hi,

The exception trace shows that SAXBuilder failed to find the JAXP 
SAXParserFactory. As Tomcat 4.0 is delivered with Crimson (which supports 
JAXP), this is probably a class loader issue.

The easiest way to solve that is to bundle the XML parser of your choice with 
your application, i.e. to add either xerces.jar or crimson.jar + jaxp.jar to 
the WEB-INF/lib directory of your application WAR file.

Laurent


Walter Slotboom wrote:

> I apologize if this appears twice, original was sent from different
> email address so system thinks I am non-member.
> 
> NT 4.0 sp6
> Tomcat v4.01
> JDOM Beta 7
> 
> I recently developed a standalone program that employed JDOM for its
> XML needs, and it worked without problem (great work by all involved in
> JDOM development).  However, the need has arisen for my program to be
> used in a Servlet / JSP context using Tomcat.  It appears that there
> exists an incompatability between the two, or some configuration
> concerns.  My current assumption is that their xerces.jar have some
> conflicts (I have tried using the xerces.jar provided with both JDOM
> and Tomcat with the same results) .
> 
> Is there a recommended Tomcat / JDOM version mixture?
> Is there a xerces.jar that works with both?
> What exactly is this exception indicating?
> Any other ideas?
> 
> The following code will fail regardless of whether XMLFile is a string
> containing the full path or a File object.
> 
> SAXBuilder builder = new SAXBuilder();
> Document doc = builder.build(XMLFile);
> 
> The exception returned is the following.
> 
> java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser
>         at
> org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:128)
>         at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:411)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:283)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:682)
>         at
> com.tpt.test.mimic.client.ClientReader.getClients(ClientReader.java:95)
>         at
> com.tpt.test.mimic.client.ClientFactory.initialize(ClientFactory.java:73)
>         at
> com.tpt.test.mimic.client.ClientFactory.<init>(ClientFactory.java:26)
>         at
> com.tpt.test.mimic.client.ClientFactory.getInstance(ClientFactory.java:88)
>         at
> com.tpt.test.mimic.client.ClientService.getClientNames(ClientService.java:53)
>         at com.tpt.test.MimicServlet.getItems(MimicServlet.java:63)
>         at org.apache.jsp.mimic$jsp._jspService(mimic$jsp.java:88)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
>         at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
>         at java.lang.Thread.run(Thread.java:484)
> 
> Thanks for any assistance...
> 
> --
> Walter
> 
> 
> =====
> --
> Walter Slotboom
> walterslotboom at yahoo.com
> 512-331-4732
> 





More information about the jdom-interest mailing list