简体   繁体   中英

ClassNotFoundException: org.hibernate.cfg.Configuration after updating JNA in eclipse

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM