NoClassDefFound/ClassCastExceptions When Using loader-reposi
murph101 May 3, 2004 5:37 PMHi all.
I have an ear file that contains two EJB's and an Axis web application. When I deploy the ear to my box (3.2.3), everything runs fine. However, when I move it over to our staging area (3.2.3 as well), the ear will not deploy due to what I have determined to be a class loading conflict with another application. I have found that adding the following to my jboss-app.xml will cause the app to deploy:
<jboss-app>
<loader-repository>repository.controller.ear=controller.ear</loader-repository>
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
<jboss-app>
At this point the application will deploy, and I can access some of my web services without any problems. The problems arise when Hibernate is initialized. I see entries in the log that indicates Hibernate is processing my mapping files, however when it creates the SessionFactory, I get the following stack trace:
18:16:35,136 INFO [Configuration] Configured SessionFactory: SasHibernateFactory
18:16:35,136 INFO [Configuration] processing one-to-many association mappings
18:16:35,136 INFO [Configuration] processing foreign key constraints
18:16:35,146 ERROR [LogInterceptor] Unexpected Error:
java.lang.NoClassDefFoundError: javax/xml/transform/TransformerFactoryConfigurationError
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
...
If I put a jar containing javax.xml.transform.TransformerFactoryConfigurationError in my ear or war, even more problems are created. The Axis servlet won't even deploy, and I get this lovely message:
17:57:03,250 ERROR [XMLUtils] Exception:
java.lang.ClassCastException
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at org.apache.axis.utils.XMLUtils.getDOMFactory(XMLUtils.java:230)
at org.apache.axis.utils.XMLUtils.(XMLUtils.java:110)
at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:209)
at org.apache.axis.AxisEngine.init(AxisEngine.java:187)
at org.apache.axis.AxisEngine.(AxisEngine.java:172)
at org.apache.axis.server.AxisServer.(AxisServer.java:126)
at org.apache.axis.server.DefaultAxisServerFactory.createServer(DefaultAxisServerFactory.java:148)
at org.apache.axis.server.DefaultAxisServerFactory.getServer(DefaultAxisServerFactory.java:112)
at org.apache.axis.server.AxisServer.getServer(AxisServer.java:111)
at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:221)
at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:187)
at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:224)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
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:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
I guess I am not sure of the whole <loader-repository> approach. I've been looking through the forums to see if I could find a clear explanation for this element's usage. My next step is ordering documentation, but if someone here could help me out, I'd greatly appreciate it.
Thanks!
Mike