Hello,
I am trying to set up a project with an annotated Hibernate object with Spring. I have tried a number of different settings. Currently I have the following in spring-web.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation">
<value>classpath:/hibernate.cfg.xml</value>
</property>
</bean>
<bean id="svinnDao" class="no.norgesgruppen.bm.data.svinn.SvinnDao">
<property name="sessionFactory"><ref local="mySessionFactory"/></property>
</bean>
</beans>
With the following in hibernate.cfg.xml:
Code:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.datasource">java:/MyDS</property>
<mapping class="no.norgesgruppen.bm.data.svinn.SvinnData" />
</session-factory>
</hibernate-configuration>
However, when I deploy to JBoss 4.0.5 I get the following:
Code:
13:46:18,005 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/spring-web.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by:
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.AnnotationConfiguration]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by:
java.lang.NoClassDefFoundError
at org.hibernate.cfg.AnnotationConfiguration.reset(AnnotationConfiguration.java:230)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:187)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:191)
at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
.....