0 Replies Latest reply on Mar 14, 2002 2:36 PM by Joe Cicelski

    ClassCastException: javax.xml.parsers.DocumentBuilderFactory

    Joe Cicelski Newbie

      I am attempting to run (under Catalina) the Wrox Struts example (downloaded from www.newparticles.com/struts/), using the version for JBoss - Tomcat 4.0.1.

      I am encountering a ClassCastException problem with the javax.xml.parsers.DocumentBuilderFactory.newInstance() method. I tries to create an instance of class: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

      documentbuilderfactory = (DocumentBuilderFactory)class1.newInstance();

      Here is the problem as I see it in the stack trace:
      ...
      root cause

      java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
      at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:103)
      at org.apache.jasper.parser.ParserUtils.parseXMLDocument(ParserUtils.java:183)

      ...


      I see that at least one other user has had similar problems with the Java Petstore application:



      [INFO,Default] ScreenFlowXmlDAO error:java.lang.ClassCastException: org.apache.
      crimson.jaxp.DocumentBuilderFactoryImpl

      The error occurred in the line:

      DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();



      I am wondering if this is a configuration issue, or some other concern?

      Thanks in advance,

      JoeC


      Here is my stack trace:

      <%-- -------------running produces errors: ------------------------------------- --%>
      http://localhost:8080/wrox-struts/index.jsp

      Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error

      --------------------------------------------------------------------------------

      type Exception report

      message Internal Server Error

      description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Servlet.init() for servlet jsp threw exception
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:871)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      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.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      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.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:536)


      root cause

      java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
      at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:103)
      at org.apache.jasper.parser.ParserUtils.parseXMLDocument(ParserUtils.java:183)
      at org.apache.jasper.compiler.TldLocationsCache.processWebDotXml(TldLocationsCache.java:165)
      at org.apache.jasper.compiler.TldLocationsCache.(TldLocationsCache.java:138)
      at org.apache.jasper.EmbededServletOptions.(EmbededServletOptions.java:324)
      at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:266)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:852)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      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.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      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.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:536)



      --------------------------------------------------------------------------------