在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