Reputation: 61
I am currently stuck at my project with a strange java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration exception.
I get this exception at the line: SessionFactory sessionFactory = new Configuration().configure("xml\hibernate.cfg.xml").buildSessionFactory();
And yes, i have the hibernate jars in lib folder and have included them in java build path.
The code and configuration doesnt seem to have a problem as they work fine in an independent java project whereas throws this exception when executed from an EJB project jar.
Is it a class loading conflict between EJB project jars and JBOSS AS7 persistance jars which are in modules folder of Jboss?
Any help would be much appreciated!!!
More details below:
I am using Eclipse, JBoss AS7.0.2 Final & hibernate 3
My project structure is as below:
PemEJB
-------.settings
-------build
-------ejbModule
-----------au (code)
-----------lib
-----------META-INF
-----------resources (some xsd files)
-----------xml (hibernate config files)
All jars in lib folder are getting included in the EJB jar when deploying and are getting extracted in the Jboss/standalone/deployments folder.
I have the following jars in the project lib folder
ant-antlr-1.6.3.jar
antlr-2.7.5H3.jar
asm-attrs.jar
cglib-2.1.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dom4j-1.6.jar
ehcache-1.1.jar
ejb-3.0.jar
hibernate-annotations-3.3.0.ga.jar
hibernate-commons-annotations-3.1.0.GA.jar
hibernate3.jar
hornetq-core-2.2.7.Final.jar
hornetq-jms-2.2.7.Final.jar
hsqldb.jar
javaee.jar
jbossall-client.jar
jms.jar
jnp-client.jar
jta.jar
log4j-1.2.9.jar
mysql-connector-java-5.0.4-bin.jar
ojdbc14.jar
wloracle.jar
wlsqlserver.jar
Upvotes: 0
Views: 5038
Reputation: 9255
Try removing the Hibernate JARs. IIRC, JBoss comes with Hibernate built-in, so you don't need to have them in your project.
Here is a post on how to use Hibernate on JBoss 7: http://relation.to/Bloggers/SomeTipsOnUsingHibernateInJBossAS700Final
Upvotes: 0