0

My Eclipse notified me that a new version of JNA is available for update and so I updated. But after that, my Java Web Application throws an exception;

java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration from

My web application works perfectly before the update. How do I fix this?

I used this hibernate dependency

        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.0.1.Final</version>
        </dependency>

My jar files are on the target folder inside the lib. I'm using JSP, Servlet, Hibernate on JBoss server.

zbryan
  • 805
  • 2
  • 12
  • 24
  • Please refer to this question once: http://stackoverflow.com/questions/9851528/java-lang-noclassdeffounderror-org-hibernate-cfg-configuration – Raman Sahasi Jun 01 '16 at 04:37

1 Answers1

0

You're getting the error because the hibernate libraries are not available to Tomcat. the hibernate library set there is an empty set called 'Web App Libraries' - this is the set your hibernate libraries need to be in.

Right click your project -> Build Path -> Configure Build Path, and remove the hibernate set from the build path. Now import the jars into the WEB-INF/lib folder. Refresh your project and now you should see them listed in the 'Web App Libraries' set (i appreciate this is somewhat annoying that you have to import them into your code base - someone else might know a better way to do this that doesn't involve copying the jars in) OR THIS MAY HELP YOU

Community
  • 1
  • 1