I added that line, and I changed the JTA reference so that it's a
datasource, right now the CAS service starts without any errors and it
correctly authenticates the user, when the user successfully logs in
however CAS errors out with:
09:36:00,146 ERROR [[cas]] Servlet.service() for servlet cas threw
exception
java.lang.IllegalArgumentException: Unknown entity:
org.jasig.cas.ticket.TicketGrantingTicketImpl
at
org
.hibernate
.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:
223)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator
$
ExtendedEntityManagerInvocationHandler
.invoke(ExtendedEntityManagerCreator.java:358)
at $Proxy298.persist(Unknown Source)
at org.springframework.orm.jpa.JpaTemplate$5.doInJpa(JpaTemplate.java:
268)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:
184)
at org.springframework.orm.jpa.JpaTemplate.persist(JpaTemplate.java:
266)
at
org
.jasig
.cas
.ticket.registry.JpaTicketRegistry.addTicket(JpaTicketRegistry.java:48)
at
org
.jasig
.cas
.CentralAuthenticationServiceImpl
.createTicketGrantingTicket(CentralAuthenticationServiceImpl.java:425)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org
.springframework
.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org
.springframework
.aop
.framework
.ReflectiveMethodInvocation
.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
....
Here is my ticketRegistry,xml now:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/tx/spring-jee-2.0.xsd">
<!-- JPA attached to jboss persistence unit -->
<bean id="ticketRegistry"
class="org.jasig.cas.ticket.registry.JpaTicketRegistry">
<constructor-arg index="0" ref="entityManagerFactory" />
</bean>
<bean id="entityManagerFactory"
class
="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"/>
<property name="generateDdl" value="true" />
<property name="database" value="SQL_SERVER"/>
</bean>
</property>
<property name="jpaProperties">
<props>
<prop
key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop
key
=
"hibernate
.transaction
.manager_lookup_class
">org.hibernate.transaction.JBossTransactionManagerLookup</prop>
<prop
key="hibernate.transaction.auto_close_session">true</prop>
<prop
key="hibernate.current_session_context_class">jta</prop>
<prop
key="hibernate.connection.release_mode">auto</prop>
</props>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:/DefaultDS"></property>
</bean>
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName" value="java:/
TransactionManager" />
<property name="autodetectUserTransaction" value="false" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- TICKET REGISTRY CLEANER -->
<bean id="ticketRegistryCleaner"
class
="org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner"
p:ticketRegistry-ref="ticketRegistry" />
<bean id="jobDetailTicketRegistryCleaner"
class
=
"org
.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
p:targetObject-ref="ticketRegistryCleaner"
p:targetMethod="clean" />
<bean id="triggerJobDetailTicketRegistryCleaner"
class="org.springframework.scheduling.quartz.SimpleTriggerBean"
p:jobDetail-ref="jobDetailTicketRegistryCleaner"
p:startDelay="20000"
p:repeatInterval="5000000" />
<bean id="scheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref
local="triggerJobDetailTicketRegistryCleaner" />
</list>
</property>
</bean>
</beans>
At this point I have everything else working except persistence/
clustering any help at all would be great, or help figuring out why
the data source wouldn't work when I tried normal JPA instead of the
JTA connection.
-Andrew
On Jun 24, 2009, at 8:44 AM, Scott Battaglia wrote:
> it looks okay. The only thing I do differently is that my
> "hibernate.hbm2ddl.auto" is in the Spring configuration. I.e.
> http://www.ja-sig.org/wiki/display/CASUM/JpaTicketRegistry
>
> Not sure if that makes a difference at all.
>
> Cheers,
> Scott
>
>
> On Tue, Jun 23, 2009 at 2:06 PM, Andrew Tillinghast <[email protected]
> > wrote:
> The other pieces of the JTA/Persistence config:
>
> $JBOSS_HOME/Server/all/deploy/cas.ear/cas.war/classes/META-INF/
> persistence.xml
> <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="CasPersistence" transaction-type="JTA">
> <jta-data-source>java:/DefaultDS</jta-data-source>
> <properties>
> <property name="hibernate.dialect"
> value="org.hibernate.dialect.SQLServerDialect"/>
> <property name="hibernate.hbm2ddl.auto"
> value="create-drop"/>
> <property
> name="hibernate.transaction.manager_lookup_class"
> value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
> <property name="jboss.entity.manager.factory.jndi.name"
>
> value="java:/CasPersistence"/>
> </properties>
> </persistence-unit>
> </persistence>
>
> $JBOSS_HOME/Server/all/deploy/mssql-ds.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <datasources>
> <local-tx-datasource>
> <jndi-name>DefaultDS</jndi-name>
> <connection-url>jdbc:sqlserver://devdb.conncoll.edu:1433</
> connection-url>
> <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</
> driver-class>
> <databaseName>JBoss</databaseName>
> <user-name>xxxxx</user-name>
> <password>*****</password>
> <metadata>
> <type-mapping>MS SQLSERVER2000</type-mapping>
> </metadata>
> </local-tx-datasource>
> </datasources>
>
> -Andrew
>
> On Jun 23, 2009, at 1:56 PM, Scott Battaglia wrote:
>
>> Andrew,
>>
>> Does the user have the appropriate privileges to create the tables
>> on the fly?
>>
>> Cheers
>> Scott
>>
>>
>> On Tue, Jun 23, 2009 at 1:31 PM, Andrew Tillinghast <[email protected]
>> > wrote:
>> Still working with CAS, JBoss 5, JPA and MS SQL.
>>
>> Working in ticketRegistry.xml
>>
>> No matter what I tried I couldn't seem to get JPA connecting to my
>> MS SQL box, I tried with the MS SQLJBC package, and the JTDS
>> package. Always goto datasource not found issues, even tried
>> changing the datasource to
>> org.springframework.jdbc.datasource.DriverManagerDataSource
>>
>> I do seem to have JPA working however by connecting it to the JBoss
>> JTA via JNDI:
>>
>> <bean id="ticketRegistry"
>> class="org.jasig.cas.ticket.registry.JpaTicketRegistry">
>> <constructor-arg index="0" ref="entityManagerFactory" />
>> </bean>
>> <bean id="entityManagerFactory"
>> class
>> =
>> "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>> <property name="persistenceUnitName" value="CasPersistence"/>
>> <property name="jpaVendorAdapter">
>> <bean
>> class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
>> <property name="showSql" value="true"/>
>> <property name="database" value="SQL_SERVER"/>
>> </bean>
>> </property>
>> <property name="jpaProperties">
>> <props>
>> <prop
>> key
>> =
>> "hibernate
>> .transaction
>> .manager_lookup_class
>> ">org.hibernate.transaction.JBossTransactionManagerLookup</prop>
>> </props>
>> </property>
>> </bean>
>>
>> Now CAS is loading correctly and JBoss is identifying it as
>> persistent but the CAS tables don't seem to be created. I was
>> expecting I would see them in the JBoss database I have on the SQL
>> box along side the JBoss persistence tables but they aren't there.
>> Right now quartz is throwing an exception:
>> java.lang.IllegalArgumentException:
>> org.hibernate.hql.ast.QuerySyntaxException:
>> TicketGrantingTicketImpl is not mapped [from
>> TicketGrantingTicketImpl]
>> and on login: org.springframework.web.util.NestedServletException:
>> Request processing failed; nested exception is
>> org.springframework.webflow.engine.ActionExecutionException:
>> Exception thrown executing [annotatedact...@13dc9f3 targetAction =
>> org.jasig.cas.web.flow.authenticationviaformact...@11d6c3a,
>> attributes = map['method' -> 'submit']] in state 'submit' of flow
>> 'login-webflow' -- action execution attributes were 'map['method' -
>> > 'submit']'; nested exception is
>> org.springframework.dao.InvalidDataAccessApiUsageException: Unknown
>> entity: org.jasig.cas.ticket.TicketGrantingTicketImpl; nested
>> exception is java.lang.IllegalArgumentException: Unknown entity:
>> org.jasig.cas.ticket.TicketGrantingTicketImpl
>>
>> I'm wondering is I just create the CAS tables by hand it might work.
>>
>> <image.gif>
>> Andrew Tillinghast
>> Sr. Web Developer
>> [email protected]
>> 270 Mohegan Avenue
>> New London, CT 06320-4196
>> Ph:860 439-5265 Fax: 860 439-2871
>> P Think before you print
>>
>> CONFIDENTIALITY: This email (including any attachments) may contain
>> confidential,
>> proprietary and privileged information, and unauthorized disclosure
>> or use is
>> prohibited. If you received this email in error, please notify the
>> sender and delete
>> this email from your system.
>>
>> --
>> 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
>>
>> --
>> 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
>
>
> --
> 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
>
> --
> 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
--
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