• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

ExceptionInInitializerError NoClassDefFoundError

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the infamouse HibernateUtil class there is this code



I am getting the NoClassDefFoundError, and not sure why or how to correct it. I am assuming it is simply a file and/or jar that I need in my classpath but not sure what it is. Any help?

I have all the required jar files listed from the _README.txt in the hibernate lib directory.

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK this might be a clue.

Caused by: java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException

Just saw it as I clicked Add Post.



Mark
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you need ehcache.jar.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought that too, and I have it already in my client and I added it to the Hibernate.deployer in JBoss, but still getting the same error.

Mark
 
Ranch Hand
Posts: 293
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate needs quite a few jars from its distribution directory. Which ones are you using?

Are you using Hibernate 3 or Hibernate 2?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are using Hibernate 3 and EJB 3.0

Thanks

Mark
 
Nick Heudecker
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark:

Have you set your logging to DEBUG? Remember that you'll need to update your log4j.properties file to reflect the new package name.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nick Heudecker:
Mark:

Have you set your logging to DEBUG? Remember that you'll need to update your log4j.properties file to reflect the new package name.



Hmm, that's an interesting response. I am not sure what the logging is set, as the Hibernate files and config files are from another developer that can run his unit tests outside the container fine. It is when I run it in the App Server that we have this problem.

Does setting the logging level change the classpath, or need more in the classpath that not changing the logging level?

Thanks

Mark
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mark,

Does setting the logging level change the classpath, or need more in the classpath that not changing the logging level?


I am not sure if I understand your question correctly but you don't have to change your classpath if you change your logging level using log4j.

Maybe you can check the dependencies for the ehcache.jar:
According to the ehcache docs you need commons-logging when using jdk1.4.
If you are using jdk1.3 you need commons-collections, version 2.1 and Apache xerces (xml-apis.jar and xercesImpl.jar), version 2.5.
I know these jars are all marked are required in the _README.txt but maybe its worth double checking.

Lars
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lars. Actually we are using JDK 1.5 Lucky us. Man it is a dream to code with.

I am thinking that I might have placed jars in the wrong directory or something in JBoss directories. I placed the cache jar into the hibernate.deployer directory and maybe it belongs in the lib directory instead.

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep that was it, I just put the jar file into the wrong directory. But now I don't even need it in my JBoss when my manager said to stop using EJBs and have the Client use Hibernate to talk to the database directly.

Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic