I think you are correct. I've tried to add a manual created persistence.xml, 
but with no luck.

I've added the file persistence.xml, inside the folder META-INF (also added) in 
the src/main/resources of both the cas-management-webapp and the 
cas-server-webapp modules.

persistance.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
        version="1.0">
        <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
        </persistence-unit>
</persistence>

Then in the deployerConfigContext.xml (cas-server-webapp) and in the 
managementConfigContext.xml (cas-management-webapp):
    <tx:annotation-driven transaction-manager="transactionManager"/>
    
        <bean id="factoryBean" 
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
                p:dataSource-ref="dataSource"
                p:jpaVendorAdapter-ref="jpaVendorAdapter"
                p:persistenceUnitName="default">
                <property name="jpaProperties">
                        <props>
                                <prop 
key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                                <prop key="hibernate.hbm2ddl.auto">update</prop>
                                <prop 
key="hibernate.connection.useUnicode">true</prop>
                                <prop 
key="hibernate.connection.characterEncoding">UTF-8</prop>
                        </props>
                </property>
        </bean>
        
        <bean id="jpaVendorAdapter"
      class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
      p:generateDdl="true"
      p:showSql="true"
      p:databasePlatform="org.hibernate.dialect.PostgreSQLDialect"/>
        
        <bean id="serviceRegistryDao" 
class="org.jasig.cas.services.JpaServiceRegistryDaoImpl"/>
        
        <bean id="transactionManager" 
class="org.springframework.orm.jpa.JpaTransactionManager"
                p:entityManagerFactory-ref="factoryBean"/>      
        
        <!-- Injects EntityManager/Factory instances into beans with 
@PersistenceUnit and @PersistenceContext -->
        <bean 
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
 />
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
                p:driverClassName="org.postgresql.Driver"
                p:url="jdbc:postgresql://<myConnectString>"
                p:username="<myUser>"
                p:password="<myPass>" />



When I restart TomCat7 I get the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'servicesManager' defined in ServletContext resource 
[/WEB-INF/spring-configuration/applicationContext.xml]: Instantiation of bean 
failed; nested
 exception is org.springframework.beans.BeanInstantiationException: Could not 
instantiate bean class [org.jasig.cas.services.DefaultServicesManagerImpl]: 
Constructor threw exception; nested exception is java.lang.IllegalArgumentExce
ption: org.hibernate.hql.internal.ast.QuerySyntaxException: 
AbstractRegisteredService is not mapped [select r from 
AbstractRegisteredService r]

I assume this is due to the fact that my persistence.xml does not specify any 
class, but I don't (can't) know every class that should be specified.
Which leads me to suspect that the persistence.xml should be included.
-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to