views:

350

answers:

2

Hello All,

I am getting the following exception when running my application in JBoss.

**

  • Exceptions

**

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

and also

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

My application is using Hibernate 3.0. I am running the application in eclipse and deploying in JBoss-5.1 with jdk version. The same application works fine in Apache Tomcat.

Please help me to resolve this.

A: 

you should add Hibernate jar file to eclipse class path.

if you have JavaEE project, than project>properties>JavaEE - add All button. To add all dependecies as runtime JavaEE dependencies.

and! =) you should check if you have added same jars (with different versions) in you classpath.

dart
I have already added the jars. Even after that it is giving the exceptions.
MalarN
Check for same jars with different versions. Maybe there are two "same" classes in one classloader. Notice that they are not equal.Check jar dependencies versions.Hope it helps.
dart
+1  A: 

could you try removing the hibernate JAR's from the EAR/WAR file when deploying on JBoss. doesn't jboss come with it's own version of hibernate?

Stefan De Boey