I'm beta testing a web front end product using a Tomcat 5.0.19 installation. Since it is in beta, I'm not sure if it is ok to give the name so I'll just call it the FooApp. It relies heavily on XML and the deployment includes many of its own jar files, include Xerces, etc.
I can run the FooApp on Tomcat with no problems. I can also run Hibernate on Tomcat with no problems, using a variety of client front ends.
BUT, the problem occurs when I combine FooApp and Hibernate. When I install them both on Tomcat, I can still use FooApp, but Hibernate will not initialize, giving the following:
>
Warning: Exception was: java.lang.ClassCastException
Warning: I will print the stack trace then carry on using the default SAX parser
java.lang.ClassCastException
<
and later it says....
>
org.dom4j.DocumentException: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar
<
I've tried all the obvious solutions, such as changing out the xercesImpl.jar and xmlParserAPIs.jar in the common/endorsed directory under Tomcat with the ones from the FooApp installation, and I've also tried placing jaxp.jar in the classpath. Nothing fixes this. Keep in mind that as soon as I pull out FooApp, Hibernate will initialize and run just fine.
Does anyone know why it would give this error? It appears that FooApp is using its own jar files to parse its XML files, and somehow, this is preventing Hibernate from properly parsing is own files. I've pasted the full stack trace below in case anyone needs it.
Can anyone offer any suggestions??
Thanks
STACK TRACE:
DEBUG http8080-Processor24 org.apache.catalina.loader.WebappClassLoader - loadClass(org.apache.commons.logging.impl.Log4JLogger, false)
INFO http8080-Processor24 net.sf.hibernate.cfg.Environment - Hibernate 2.1.2
INFO http8080-Processor24 net.sf.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.connection.username=root, hibernate.connection.password=password, hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.pool_size=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/grsdb, hibernate.show_sql=true, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
INFO http8080-Processor24 net.sf.hibernate.cfg.Environment - using CGLIB reflection optimizer
INFO http8080-Processor24 net.sf.hibernate.cfg.Configuration - Mapping file: C:\MYFILES\PROJECTS\GRSFoo\WebModule\WEB-INF\classes\Users.hbm.xml
Warning: Caught exception attempting to use SAX to load a SAX XMLReader
Warning: Exception was: java.lang.ClassCastException
Warning: I will print the stack trace then carry on using the default SAX parser
java.lang.ClassCastException
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:74)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:647)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:530)
at org.dom4j.io.SAXReader.read(SAXReader.java:309)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:187)
at org.winston.grs.datasource.GRSHibernateUtil.<clinit>(GRSHibernateUtil.java:36)
at org.winston.grs.datasource.GRSHibernateDataSource.getAllUsers(GRSHibernateDataSource.java:148)
at org.winston.grs.foo.FooInterface.getAllUsers(FooInterface.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at foogateway.adapter.java.JavaAdapter.invokeFunction(JavaAdapter.java:50)
at foogateway.filter.AdapterFilter.invoke(AdapterFilter.java:158)
at foogateway.filter.SecurityFilter.invoke(SecurityFilter.java:84)
at foogateway.filter.LicenseFilter.invoke(LicenseFilter.java:57)
at foogateway.filter.ErrorFilter.invoke(ErrorFilter.java:43)
at foogateway.filter.LogFilter.invoke(LogFilter.java:43)
at foogateway.filter.BatchProcessFilter.invoke(BatchProcessFilter.java:63)
at foogateway.filter.DebugFilter.invoke(DebugFilter.java:38)
at foogateway.filter.SerializationFilter.invoke(SerializationFilter.java:57)
at foogateway.Gateway.invoke(Gateway.java:207)
at foogateway.controller.GatewayServlet.service(GatewayServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at foo.bootstrap.BootstrapServlet.service(BootstrapServlet.java:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)
ERROR http8080-Processor24 net.sf.hibernate.cfg.Configuration - Could not configure datastore from input stream
org.dom4j.DocumentException: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar Nested exception: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:187)
at org.winston.grs.datasource.GRSHibernateUtil.<clinit>(GRSHibernateUtil.java:36)
at org.winston.grs.datasource.GRSHibernateDataSource.getAllUsers(GRSHibernateDataSource.java:148)
at org.winston.grs.foo.FooInterface.getAllUsers(FooInterface.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at foogateway.adapter.java.JavaAdapter.invokeFunction(JavaAdapter.java:50)
at foogateway.filter.AdapterFilter.invoke(AdapterFilter.java:158)
at foogateway.filter.SecurityFilter.invoke(SecurityFilter.java:84)
at foogateway.filter.LicenseFilter.invoke(LicenseFilter.java:57)
at foogateway.filter.ErrorFilter.invoke(ErrorFilter.java:43)
at foogateway.filter.LogFilter.invoke(LogFilter.java:43)
at foogateway.filter.BatchProcessFilter.invoke(BatchProcessFilter.java:63)
at foogateway.filter.DebugFilter.invoke(DebugFilter.java:38)
at foogateway.filter.SerializationFilter.invoke(SerializationFilter.java:57)
at foogateway.Gateway.invoke(Gateway.java:207)
at foogateway.controller.GatewayServlet.service(GatewayServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at foo.bootstrap.BootstrapServlet.service(BootstrapServlet.java:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)
Nested exception:
org.xml.sax.SAXException: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:100)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:647)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:530)
at org.dom4j.io.SAXReader.read(SAXReader.java:309)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:187)
at org.winston.grs.datasource.GRSHibernateUtil.<clinit>(GRSHibernateUtil.java:36)
at org.winston.grs.datasource.GRSHibernateDataSource.getAllUsers(GRSHibernateDataSource.java:148)
at org.winston.grs.foo.FooInterface.getAllUsers(FooInterface.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at foogateway.adapter.java.JavaAdapter.invokeFunction(JavaAdapter.java:50)
at foogateway.filter.AdapterFilter.invoke(AdapterFilter.java:158)
at foogateway.filter.SecurityFilter.invoke(SecurityFilter.java:84)
at foogateway.filter.LicenseFilter.invoke(LicenseFilter.java:57)
at foogateway.filter.ErrorFilter.invoke(ErrorFilter.java:43)
at foogateway.filter.LogFilter.invoke(LogFilter.java:43)
at foogateway.filter.BatchProcessFilter.invoke(BatchProcessFilter.java:63)
at foogateway.filter.DebugFilter.invoke(DebugFilter.java:38)
at foogateway.filter.SerializationFilter.invoke(SerializationFilter.java:57)
at foogateway.Gateway.invoke(Gateway.java:207)
at foogateway.controller.GatewayServlet.service(GatewayServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at foo.bootstrap.BootstrapServlet.service(BootstrapServlet.java:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)
ERROR http8080-Processor24 net.sf.hibernate.cfg.Configuration - Could not configure datastore from file: C:\MYFILES\PROJECTS\GRSFoo\WebModule\WEB-INF\classes\Users.hbm.xml
net.sf.hibernate.MappingException: org.dom4j.DocumentException: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar Nested exception: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:293)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:187)
at org.winston.grs.datasource.GRSHibernateUtil.<clinit>(GRSHibernateUtil.java:36)
at org.winston.grs.datasource.GRSHibernateDataSource.getAllUsers(GRSHibernateDataSource.java:148)
at org.winston.grs.foo.FooInterface.getAllUsers(FooInterface.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at foogateway.adapter.java.JavaAdapter.invokeFunction(JavaAdapter.java:50)
at foogateway.filter.AdapterFilter.invoke(AdapterFilter.java:158)
at foogateway.filter.SecurityFilter.invoke(SecurityFilter.java:84)
at foogateway.filter.LicenseFilter.invoke(LicenseFilter.java:57)
at foogateway.filter.ErrorFilter.invoke(ErrorFilter.java:43)
at foogateway.filter.LogFilter.invoke(LogFilter.java:43)
at foogateway.filter.BatchProcessFilter.invoke(BatchProcessFilter.java:63)
at foogateway.filter.DebugFilter.invoke(DebugFilter.java:38)
at foogateway.filter.SerializationFilter.invoke(SerializationFilter.java:57)
at foogateway.Gateway.invoke(Gateway.java:207)
at foogateway.controller.GatewayServlet.service(GatewayServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at foo.bootstrap.BootstrapServlet.service(BootstrapServlet.java:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.dom4j.DocumentException: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar Nested exception: Could not initialize a SAX Parser. Please add a SAX parser to your classpath along with preferably jaxp.jar
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283)
|