-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: NoClassDefFoundError cfg.hibernate.AnnotationConfiguration
PostPosted: Mon Oct 03, 2011 10:28 am 
Newbie

Joined: Fri Sep 30, 2011 7:38 pm
Posts: 2
I have a problem, eclipse is not picking up org.hibernate.cfg.AnnotationConfiguration, can someone provide guidance to resolve this issue, please?
I don't see any conflicting jars or classes. Additionally, I can see the AnnotationConfiguration.class file inside of the hibernate-annotations-3.4GA.jar file. But I still get the java.lan.NoClassDefFoundException for AnnotationConfiguration.class as noted towards the end of my post.

Jboss 7.0 standalone running inside of indigo Eclipse Environment.

class path jars.
hibernate-3.jar
org.springframework.*-3.0.0.M3.jar

servlet-xml

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
<!-- Data sources -->
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.mysql.jdbcDriver" />
<property name="url" value="jdbc:mysql://localhost/sr_test_db" />
<property name="username" value="xx" />
<property name="password" value="xxxxx" />
</bean>
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="annotatedClasses">
<value>com.geno.core.sr.model.Employee</value>
<!-- value>classpath*:com.geno.core.sr.controller</value -->
</property>
<property name="mappingResources">
<value>com.geno.core.sr.model.Employee.hbm.xml</value>
</property>
<!-- Hibernate Settings -->
<property name="hibernateProperties">
<props>
<prop key="connection.pool_size">1</prop>
<prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">false</prop>
</props>
</property>
</bean>
<bean id="employeeDao" class="com.geno.core.sr.model.EmployeeImp">
<property name="sessionFactory" ref="mySessionFactory" />
</bean>
<bean name="/employee/*.htm" class="com.geno.core.sr.controller.ReportReferenceController">
<property name="employeeIF" ref="employeeDao" />
</bean>
</beans>


WEB-INF/lib

antlr-2.7.6.jar org.springframework.expression-3.0.0.M3.jar
antlr-runtime-3.0.1.jar org.springframework.orm-3.0.0.M3.jar
cglib-2.2.jar javassist-3.4.GA.jar org.springframework.transaction-3.0.0.M3.jar
commons-collections-3.1.jar javax.servlet.jar org.springframework.web-3.0.0.M3.jar
commons-dbcp-1.2.2.jar jboss-archive-browsing.jar org.springframework.web.servlet-3.0.0.M3.jar
commons-logging.jar mysql-connector-java-5-2.1.6.jar servlet-api.jar
commons-pool-1.3.jar org.springframework.asm-3.0.0.M3.jar slf4j-api.jar
dom4j-1.6.1.jar org.springframework.beans-3.0.0.M3.jar slf4j-simple-1.5.8.jar
ejb3-persistence.jar org.springframework.context-3.0.0.M3.jar spring.jar
org.springframework.context.support-3.0.0.M3.jar standard.jar
org.springframework.core-3.0.0.M3.jar
hibernate3.jar



Employee.java

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Employee {

@Id
int employee_id;

int prospect_employer_id;
int employee_history_id;
int employee_location_id;
int employer_id;

....
...
)

Employee.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Sep 15, 2011 10:14:04 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.geno.core.sr.model.Employee" table="EMPLOYEE">
<id name="employee_id" type="int">
<column name="EMPLOYEE_ID" />
<generator class="assigned" />
</id>
<property name="prospect_employer_id" type="int">
<column name="PROSPECT_EMPLOYER_ID" />
</property>
<property name="employee_history_id" type="int">
<column name="EMPLOYEE_HISTORY_ID" />
</property>

.....
etc
</hibernate-mapping>


Exception:
19:00:29,735 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ShareReference].[dispatcher]] (http--127.0.0.1-8080-32) Allocate exception for servlet dispatcher: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.AnnotationConfiguration
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_24]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_24]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_24]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_24]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:127) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:105) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newConfiguration(LocalSessionFactoryBean.java:764) [org.springframework.orm-3.0.0.M3.jar:]
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:514) [org.springframework.orm-3.0.0.M3.jar:]
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) [org.springframework.orm-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:514) [org.springframework.orm-3.0.0.M3.jar:]
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) [org.springframework.orm-3.0.0.M3.ja
r:] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368) [org.springfr
amework.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:476) [org.springframewor
k.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:412) [org.springframework.beans-3.0.0.M3.jar:]
at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_24] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:383) [org.springframework.
beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:276) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.beans-3.0.
0.M3.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:175) [org.springframework.beans-3.0.0.M3.jar:]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:479) [org.springframework.be
ans-3.0.0.M3.jar:]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716) [org.springframework.c
ontext-3.0.0.M3.jar:]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377) [org.springframework.context-3.0.0.M3.jar:]
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:427) [org.springframework.web.servlet-3.0.0.M3.jar:]
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:341) [org.springframework.web.servlet-3.0.0.M3.jar:]
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307) [org.springframework.web.servlet-3.0.0.M3.jar:]
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) [org.springframework.web.servlet-3.0.0.M3.jar:]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]


Top
 Profile  
 
 Post subject: Re: NoClassDefFoundError cfg.hibernate.AnnotationConfiguration
PostPosted: Fri Dec 02, 2011 4:25 pm 
Newbie

Joined: Fri Dec 02, 2011 4:20 pm
Posts: 1
Hi - I am in the same boat...

I am looking to run an example http://viralpatel.net/blogs/2010/11/...e-example.html of using spring, hibernate, mySQL and maven, but am getting stuck on NoClassDefFoundError.
I am new to Spring/Hibernate/Maven and have some limited Tomcat knowledge and would appreciate some help in getting this example running.

I deploy successfully using mvn tomcat:deploy

Code:
H:\APPS\Profile\Java\Documents\workspace-sts-2.8.0.RELEASE\Spring3HibernateMaven> mvn tomcat:deploy
Picked up _JAVA_OPTIONS: -Duser.home=H:\Apps\Profile\Java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring3HibernateMaven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
[INFO] Deploying war to http://localhost:8080/Spring3HibernateMaven
[INFO] OK - Deployed application at context path /Spring3HibernateMaven
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------


I create the necessary classpaths using mvn eclipse:eclipse

Code:
H:\APPS\Profile\Java\Documents\workspace-sts-2.8.0.RELEASE\Spring3HibernateMaven>type .classpath
<classpath>
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
<classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
<classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-dbcp/commons-dbcp/20030825.184428/commons-dbcp-20030825.184428.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/20030825.183949/commons-pool-20030825.183949.jar"/>
<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.1.ga/hibernate-3.2.1.ga.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.3.0.ga/hibernate-commons-annotations-3.3.0.ga.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.4.0.GA/hibernate-entitymanager-3.4.0.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.0.6.RELEASE/spring-aop-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-asm/3.0.6.RELEASE/spring-asm-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.0.6.RELEASE/spring-beans-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.0.6.RELEASE/spring-context-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context-support/3.0.6.RELEASE/spring-context-support-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/3.0.6.RELEASE/spring-core-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/3.0.6.RELEASE/spring-expression-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-jdbc/3.0.6.RELEASE/spring-jdbc-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-orm/3.0.6.RELEASE/spring-orm-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/3.0.6.RELEASE/spring-tx-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/3.0.6.RELEASE/spring-web-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/3.0.6.RELEASE/spring-webmvc-3.0.6.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>


I get the exception regarding org.hibernate.cfg.AnnotationConfiguration

Code:
HTTP Status 500
Dec 2, 2011 4:31:08 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring': initialization started
Dec 2, 2011 4:31:08 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'spring-servlet': startup date [Fri Dec 02 16:31:08 GMT 2011]; root of context hierarchy
Dec 2, 2011 4:31:08 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-servlet.xml]
Dec 2, 2011 4:31:08 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from ServletContext resource [/WEB-INF/jdbc.properties]
Dec 2, 2011 4:31:08 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e6361e: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,contactController,contactDAOImpl,contactServiceImpl,jspViewResolver,messageSource,propertyConfigurer,dataSource,sessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager]; root of factory hierarchy
Dec 2, 2011 4:31:08 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e6361e: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,contactController,contactDAOImpl,contactServiceImpl,jspViewResolver,messageSource,propertyConfigurer,dataSource,sessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager]; root of factory hierarchy
Dec 2, 2011 4:31:08 PM org.springframework.web.servlet.FrameworkServlet initServletBean
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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 java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 33 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 48 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 59 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' 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
   ... 61 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.AnnotationConfiguration
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   ... 71 more


All the .jar files are where I would expect them to be under Tomcat (and some jars coming in due to resolved dependencies).

Code:
Directory of C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\Spring3HibernateMaven\WEB-INF\lib

antlr-2.7.6.jar
aopalliance-1.0.jar
asm-1.5.3.jar
asm-attrs-1.5.3.jar
cglib-2.1_3.jar
commons-collections-3.1.jar
commons-dbcp-20030825.184428.jar
commons-logging-1.1.1.jar
commons-pool-20030825.183949.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence-1.0.2.GA.jar
hibernate-3.2.1.ga.jar
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.3.0.ga.jar
hibernate-core-3.3.2.GA.jar
hibernate-entitymanager-3.4.0.GA.jar
javassist-3.4.GA.jar
jstl-1.1.2.jar
jta-1.1.jar
mysql-connector-java-5.1.10.jar
persistence-api-1.0.jar
servlet-api-2.5.jar
slf4j-api-1.5.8.jar
spring-aop-3.0.6.RELEASE.jar
spring-asm-3.0.6.RELEASE.jar
spring-beans-3.0.6.RELEASE.jar
spring-context-3.0.6.RELEASE.jar
spring-context-support-3.0.6.RELEASE.jar
spring-core-3.0.6.RELEASE.jar
spring-expression-3.0.6.RELEASE.jar
spring-jdbc-3.0.6.RELEASE.jar
spring-orm-3.0.6.RELEASE.jar
spring-tx-3.0.6.RELEASE.jar
spring-web-3.0.6.RELEASE.jar
spring-webmvc-3.0.6.RELEASE.jar
standard-1.1.2.jar
xml-apis-1.0.b2.jar


And this is my pom.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>Spring3HibernateMaven</groupId>
   <artifactId>Spring3HibernateMaven</artifactId>
   <packaging>war</packaging>
   <version>0.0.1-SNAPSHOT</version>
   <description></description>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
               <source>${java-version}</source>
               <target>${java-version}</target>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
               <archive>
                  <manifest>
                     <addClasspath>true</addClasspath>
                  </manifest>
               </archive>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
               <execution>
                  <id>install</id>
                  <phase>install</phase>
                  <goals>
                     <goal>sources</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.5</version>
            <configuration>
               <encoding>UTF-8</encoding>
            </configuration>
         </plugin>

         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.1</version>
            <configuration>
               <server>apacheTomcatServer</server>
               <url>http://localhost:8080/manager/html</url>
               <path>/Spring3HibernateMaven</path>
            </configuration>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>2.5</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-beans</artifactId>
         <version>${org.springframework-version}</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-jdbc</artifactId>
         <version>${org.springframework-version}</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-web</artifactId>
         <version>${org.springframework-version}</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-webmvc</artifactId>
         <version>${org.springframework-version}</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-orm</artifactId>
         <version>${org.springframework-version}</version>
      </dependency>



      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <version>3.3.2.GA</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-annotations</artifactId>
         <version>3.4.0.GA</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-commons-annotations</artifactId>
         <version>3.3.0.ga</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <version>3.4.0.GA</version>
      </dependency>




      <dependency>
         <groupId>taglibs</groupId>
         <artifactId>standard</artifactId>
         <version>1.1.2</version>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jstl</artifactId>
         <version>1.1.2</version>
      </dependency>
      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <version>5.1.10</version>
      </dependency>
      <dependency>
         <groupId>commons-dbcp</groupId>
         <artifactId>commons-dbcp</artifactId>
         <version>20030825.184428</version>
      </dependency>
      <dependency>
         <groupId>commons-pool</groupId>
         <artifactId>commons-pool</artifactId>
         <version>20030825.183949</version>
      </dependency>
   </dependencies>
   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <java-version>1.6</java-version>
      <org.springframework-version>3.0.6.RELEASE</org.springframework-version>
      <org.aspectj-version>1.6.9</org.aspectj-version>
      <org.slf4j-version>1.5.10</org.slf4j-version>
   </properties>
</project>


What am I doing wrong?


Many Thanks

dc3


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.