jQuery in Action, 2nd edition*
The moose likes Object Relational Mapping and the fly likes java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration" Watch "java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration" New topic
Author

java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

Sms Krishnan
Greenhorn

Joined: May 20, 2012
Posts: 2
Hi,

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:
<project name>
-------.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
Manuel Petermann
Ranch Hand

Joined: Jul 19, 2011
Posts: 175

The whole stacktrace and the hibernate.cfg.xml would be a good thing to know. Could you post those?


Please correct my English.
Sms Krishnan
Greenhorn

Joined: May 20, 2012
Posts: 2
Thanks for the response. Please find below the hibernate.cfg.xml and stacktrace:



16:41:31,570 INFO [stdout] (Thread-14 (group:HornetQ-client-global-threads-8698252)) Creating Hibernate sessionFactory
16:41:31,571 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor] (Thread-14 (group:HornetQ-client-global-threads-8698252)) javax.ejb.EJBTransactionRolledbackException: Unexpected Error
16:41:31,571 INFO [stdout] (Thread-14 (group:HornetQ-client-global-threads-8698252)) exception------------------------
16:41:31,571 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) javax.ejb.EJBTransactionRolledbackException: Unexpected Error
16:41:31,571 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:125)
16:41:31,571 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:196)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:286)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:182)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146)
16:41:31,572 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.ejb.CFSDataManager$$$view13.processRequest(Unknown Source)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.jms.GetCfsDataProxy.processRequest(GetCfsDataProxy.java:49)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.jms.CFSDataListener.onMessage(CFSDataListener.java:58)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
16:41:31,573 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.lang.reflect.Method.invoke(Unknown Source)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,574 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ViewDescription$ComponentDispatcherInterceptor.processInvocation(ViewDescription.java:202)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:50)
16:41:31,575 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.component.messagedriven.MessageDrivenInvocationContextInterceptor.processInvocation(MessageDrivenInvocationContextInterceptor.java:60)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76)
16:41:31,576 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at javax.jms.MessageListener$$$view16.onMessage(Unknown Source)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.lang.reflect.Method.invoke(Unknown Source)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at $Proxy25.onMessage(Unknown Source)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)
16:41:31,577 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:866)
16:41:31,578 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:44)
16:41:31,578 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:983)
16:41:31,578 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
16:41:31,578 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
16:41:31,578 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.lang.Thread.run(Unknown Source)
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) Caused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.db.DatabaseAdapter.saveServiceCfsData(DatabaseAdapter.java:26)
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.ejb.CFSDataManagerBean.createSubscriber(CFSDataManagerBean.java:38)
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at au.com.telstra.aan.pem.ejb.CFSDataManagerBean.processRequest(CFSDataManagerBean.java:23)
16:41:31,579 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at java.lang.reflect.Method.invoke(Unknown Source)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
16:41:31,580 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
16:41:31,581 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ee.component.ViewDescription$ComponentDispatcherInterceptor.processInvocation(ViewDescription.java:202)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:50)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor$CustomSessionInvocationContext.proceed(SessionInvocationContextInterceptor.java:126)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:194)
16:41:31,582 ERROR [stderr] (Thread-14 (group:HornetQ-client-global-threads-8698252)) ... 54 more
16:41:31,582 INFO [stdout] (Thread-14 (group:HornetQ-client-global-threads-8698252)) Exiting onMessage method of CFSDataListener
 
GeeCON Prague 2014
 
subject: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration