Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError

 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the above message while using logging in a Hibernate program.

The message is java.lang.NoClassDefFoundError: Could not initialize class
org.hibernate.validator.ClassValidator.

I have all the jar files, namely, ejb3-persistence, hibernate3, hibernate.cfg,
hibernate-annotations, hibernate-commons-annotations, hibernate-entitymanager and hibernate-validator in both classpath and Tomcat lib file.
What could be the reason.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classloaders are a mysterious thing.

Which class is using the class that can't be found. Package the jar along with that class, not just on the JVM or Tomcats classpath. Various components have different classloaders and this can trigger just these types of problems.

-Cameron McKenzie
 
Sunder Ganapathy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Cameron.

When I came to know that validating can also be done using Hibernate,
I started using the same "C:\_hiblib" for this also. I was using Log4j also
in my program . In one of the JBOSS forums, I read that duplicate declarations
cause problems . Now the issue is resolved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic