在JBoss中运行我的应用程序时出现以下异常。Hibernate异常无法解析配置:。 WEB-INF hibernate.cfg.xml
**
- 例外
**
2010-02-17 15:10:43,435 INFO [STDOUT] (main) ERROR [2010-10-17 03:10] [main] (HibernateUtil.java:22) - Hibernate exceptionCould not parse configuration: .\WEB-INF\hibernate.cfg.xml 2010-02-17 15:10:43,435 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/Wimax]] (main) StandardWrapper.Throwable java.lang.NoClassDefFoundError: Could not initialize class x.x.x.x.HibernateUtil
也
2010-02-17 15:10:43,373 INFO [STDOUT] (main) Warning: Caught exception attempting to use SAX to load a SAX XMLReader 2010-02-17 15:10:43,373 INFO [STDOUT] (main) Warning: Exception was: java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader 2010-02-17 15:10:43,373 INFO [STDOUT] (main) Warning: I will print the stack trace then carry on using the default SAX parser 2010-02-17 15:10:43,373 ERROR [STDERR] (main) java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
我的应用程序使用Hibernate 3.0。我在eclipse中运行应用程序,并使用jdk版本在JBoss-5.1中进行部署。相同的应用程序在Apache Tomcat中工作正常。
请帮我解决这个问题。
我已经添加了罐子。即使在此之后,它也是例外。 – MalarN 2010-02-17 11:34:29
检查具有不同版本的相同罐子。也许在一个类加载器中有两个“相同”的类。注意它们不相同。 检查jar依赖项版本。 希望它有帮助。 – dart 2010-02-17 11:43:37