Hi,

You really should rely on maven dependencies to get the correct versions of 
Hibernate libraries. On the pom.xml there is a section <!-- TESTS FOR JPA --> 
that you should uncomment and relaunch maven2...

Persistence.xml is no longer required as "hibernate.dialect" is specified in 
jpaProperties section on applicationContext.xml.


Romain

Nick Fielding a écrit :
> Hi,
> 
> I'm trying to get service persistence working by implementing a database
> backend for the service manager. However, I keep getting the following
> NoClassDefFound error, despite having installed all the Hibernate
> libraries...
> 
> org.springframework.beans.BeanInstantiationException: Could not
> instantiate bean class
> [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]:
> Constructor threw exception; nested exception is
> java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence
> Caused by: 
> java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence
>       at
> org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.<init>(Hibe
> rnateJpaVendorAdapter.java:54)
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>       at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
> ccessorImpl.java:39)
>       at sun.reflect.DelegatingConstructorAccessorImpl.newInsta...
> 
> 
> Here is a snippet of my applicationContext.xml configuration:
> 
>   <!-- For persistent services... -->
>   <bean id="serviceRegistryDao"
> class="org.jasig.cas.services.JpaServiceRegistryDaoImpl"
> p:entityManagerFactory-ref="entityManagerFactory" />
>       <!-- <property name="persistenceUnitName" value="CasPersistence"/>
> -->
>      <!-- This is the EntityManagerFactory configuration for Hibernate
> -->
>              <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBea
> n">
>                      
>                      <property name="dataSource" ref="dataSource"/>
>                      <property name="jpaVendorAdapter">
>                              <bean
> class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
>                                      <property name="generateDdl"
> value="true"/>
>                                      <property name="showSql"
> value="true" />
>                              </bean>
>                      </property>
>                      <property name="jpaProperties">
>                              <props>
>                                      <prop
> key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
>                                      <prop
> key="hibernate.hbm2ddl.auto">create-drop</prop>
>                              </props>
>                      </property>
>              </bean>
> 
>   <bean id="transactionManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>               <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
>       </bean>
>     
>       <tx:annotation-driven transaction-manager="transactionManager"/>
>       
>   <bean id="dataSource"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>     <property name="jndiName" value="java:comp/env/jdbc/myUWEDb"/>
>     <property name="defaultObject" ref="dataSourceNonJNDI" />
>   </bean>
> 
>   <bean id="dataSourceNonJNDI" destroy-method="close"
> class="org.apache.commons.dbcp.BasicDataSource" >
>     <property name="driverClassName"
> value="com.inet.tds.TdsDataSource"/>
>     <property name="url"
> value="jdbc:inetdae7:sdmz-atg01.uwe.ac.uk:1433?database=casService&amp;l
> anguage=english&amp;failover=false"/>
>     <property name="username" value="uPortalAdmin"/>
>     <property name="password" value="ATG*****"/>
>   </bean>
>   <!-- End. -->
> 
> 
> I have also read somewhere about configuring a Persistence.xml file, but
> why and how it should be configured remains a mystery.
> 
> Any help would be appreciated!
> 
> Thanks,
> 
> Nick
> UWE
> 
> 
> This email was independently scanned for viruses by McAfee anti-virus 
> software and none were found
> _______________________________________________
> Yale CAS mailing list
> [email protected]
> http://tp.its.yale.edu/mailman/listinfo/cas
> 
_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to