• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am getting an exception in a start up bean. Its in DocumentAppStartUpBean implements javax.ejb.SessionBean. Right when we try to get the session factory for hibernate it throws the exception.
The code is blowing up in sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory(); The error occurs when I am starting up our data DataAccessServiceEar. So if I was running under Tomcat I would guess that the hibernate3.jar needed to be in the WEB-INF directory; however, since this is WebSphere and we are using EJB I am not sure where to look next.

Any suggestions would be appreciated.
Thanks,
Mark
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever the container you run it needs the required jar files by the Hibernate to work with it. So what restrictions you have here?

And welcome to the CodeRanch!
 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijitha,
Thanks for responding. I have the Hibernate3.jar in the build path for the project. The DocumentAppStartUpBean is the bean that is throwing the exception.
The error is EJB threw an unexpected (non-declared) exception during invocation of method "start" on bean "BeanId(DataAccessService#InvcDASEJB.jar#DocumentAppStartUp, null)". Exception data: java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration. The problem occurs when I start the ear file in WebSphere console.

I guess the WebSphere server is not seeing the hibernate jars?

The directory for the server is C:\Program Files (x86)\IBM\WID7_WTE\runtimes\bi_v7\lib

Should I try putting the jars in there...

Thanks,
Mark
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's your application structure EAR/WAR/JAR etc... how they formed and any special configuration(s) which might relate to this? And where is Hibernate jars located inside the application currently?
 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using EAR files. However, I am not sure what you are asking when you say special configuration...
 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijitha,

Do you know the typical place that WebSphere expects the hibernate jar to be? The hibernate jar is correctly configured on the build path so all of the code compiles. I am just hitting the exception when the EAR is started up...

Thanks,
Mark
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hibernate jar is correctly configured on the build path so all of the code compiles.

That's why I asked where you have the jar inside the application in the server (if you have it there)?
 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijitha,

Yes, the problem is that I do not know where I should put the hibernate jar so that the WebSphere server can find it. Do you know where the hibernate jar should go? For a Tomcat server you just put it in the WEB-INF directory; however, I do not know where to put it so that WebSphere can find it...

Thanks,
Mark
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the WEB-INF/lib directory.
 
Marc Snider
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, typically you can place those jars in the WEB-INF/lib directory. However, that is not working running under WebSphere. When the EAR file for the EJBs starts up it is throwing an exception .

[1/23/12 9:27:56:014 EST] 00000045 StartBeanInfo E STUP0006E: Exception calling startup bean named ejb/com/mcd/invoicing/das/startup/DocumentAppStartUpHome, exception was java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: ; nested exception is:
java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
at com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:235)
at com.ibm.CORBA.iiop.UtilDelegateImpl.wrapException(UtilDelegateImpl.java:743)
at javax.rmi.CORBA.Util.wrapException(Util.java:296)

Any thoughts???... The org/dom4j/io/SAXReader should be in the jars that I have currently deployed...

Thanks,
Mark
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most probably it looks you have the jar missing. Some of these may include Hibernate dependencies which you don't need at the build time. Make sure you have them all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic