Note that there are some explanatory texts on larger screens.

plurals
  1. PODeployed Tomcat 7 WAR application throws NoClassDefFoundError error
    primarykey
    data
    text
    <p>I am working on a hello-world type of web application. I am using Eclipse Helios as my IDE, Maven 2 to handle dependencies, and a locally run Tomcat 7 server to deploy and test. The application is Spring MVC based and uses Hibernate for data management.</p> <p>I can successfully package the project into a WAR file. When I deploy the WAR in Tomcat, the following error is reported in the logs:</p> <blockquote> <p>SEVERE: Context initialization failed</p> <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateSessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.AnnotationConfiguration at</p> <p>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) Etc...</p> </blockquote> <p>I checked to be sure that the correct dependency is included in my POM, and it is:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt; &lt;version&gt;3.4.0.GA&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;optional&gt;false&lt;/optional&gt; &lt;/dependency&gt; </code></pre> <p>I checked to see that the packaged WAR file has the required JAR file which has the class mentioned (org.hibernate.cfg.AnnotationConfiguration) in the error and it does:</p> <blockquote> <p>./Tomcat 7/webapps/helloworld/WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar</p> </blockquote> <p>Based on this information, I figure that this might be a classpath configuration issue. From the documentation I've read on Tomcat 7, Tomcat should be able to utilize the JAR files in "/WEB-INF/lib" folder. Any one know if I may have skipped a step in configuration of Tomcat in order for it to recognize the JAR files in the lib folder of a webapp?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload