Ok, sorry to be confusing. Let me clarify.

We're running on JBoss 5.1.0GA and for other applications we need  
JBoss rather then Tomcat, would prefer 5.X could possibly function  
under 4.2.x also seems like going 4.2 would just delay the issue.

I've got CAS installed with OW, LDAP etc, but no persistence if I use  
the <bean id="ticketRegistry"  
class="org.jasig.cas.ticket.registry.DefaultTicketRegistry" /> the CAS  
service is working fine, actually deployed in production this way  
right now and working for the few hundred students that check email  
during the summer.

We'll be "casifying" additional applications and use volume will  
increase as the summer end so we'll need High Availablity/Clustering  
so I'm attempting to establish persistence, I've reviewed the  
persistence overview here: 
http://www.ja-sig.org/wiki/display/CASUM/Service+Availability+Strategies 
  and I've chosen to go with JPA because we have an existing clustered  
MS SQL server on our backend.

I've followed through the steps in the JPA instructions here: 
http://www.ja-sig.org/wiki/display/CASUM/JpaTicketRegistry

However, when attempting to follow those instructions CAS startup  
would fail with "Instantiation of bean failed; nested exception is  
java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/ 
lookup/DataSourceLookup"

This error came up even though I tried different datasources and I  
made sure that the proper jars were in my classpath. I tried using the  
SQLJDBC drivers and data source first and then also with the jtds  
ones. All of them came back with the DataSourceLookup error.

Example of one of the datasource beans I tried:
<bean id="dataSource"  
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
                p:driverClassName="net.sourceforge.jtds.jdbc.Driver"
                
p:url="jdbc:jtds:sqlserver://devdb.conncoll.edu:1433;database=CAS;"
                p:username="xxxxxx"
                p:password="******" />

After some more research I found information about connecting the JPA  
persistence to the JBoss JTA persistence. http://www.swview.org/node/214
I changed my ticketRegistry.xml as per the my previous list posting.
Now CAS starts error free and validates login but fails on creating  
the ticket when login is successful  the text of the error leads me to  
think that the database connection is established but the tables  
aren't there when trying to save the ticket.

Despite the error free startup I'm not seeing tables for CAS being  
created in the jboss databse (no error in CAS.log either.)

CAS.log shows the following error on Clean, which is essentially the  
same error as ticket create:

2009-06-24 11:53:38,841 INFO  
[org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] -  
Starting cleaning of expired tickets from ticket registry at [Wed Jun  
24 11:53:38 EDT 2009]
2009-06-24 11:53:39,177 ERROR [org.quartz.core.JobRunShell] - Job  
DEFAULT.jobDetailTicketRegistryCleaner threw an unhandled Exception:
org 
.springframework.scheduling.quartz.JobMethodInvocationFailedException:  
Invocation of method 'clean' on target class [class $Proxy292] failed;  
nested exception is  
org.springframework.dao.InvalidDataAccessApiUsageException:  
org.hibernate.hql.ast.QuerySyntaxException: TicketGrantingTicketImpl  
is not mapped [from TicketGrantingTicketImpl]; nested exception is  
java.lang.IllegalArgumentException:  
org.hibernate.hql.ast.QuerySyntaxException: TicketGrantingTicketImpl  
is not mapped [from TicketGrantingTicketImpl]
        at  
org 
.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean 
$ 
MethodInvokingJob 
.executeInternal(MethodInvokingJobDetailFactoryBean.java:269)
        at  
org 
.springframework 
.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
        at org.quartz.simpl.SimpleThreadPool 
$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException:  
org.hibernate.hql.ast.QuerySyntaxException: TicketGrantingTicketImpl  
is not mapped [from TicketGrantingTicketImpl]; nested exception is  
java.lang.IllegalArgumentException:  
org.hibernate.hql.ast.QuerySyntaxException: TicketGrantingTicketImpl  
is not mapped [from TicketGrantingTicketImpl]
        at  
org 
.springframework 
.orm 
.jpa 
.EntityManagerFactoryUtils 
.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:271)
        at  
org 
.springframework 
.orm 
.jpa 
.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java: 
120)
        at  
org 
.springframework 
.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java: 
212)
....

I fully admit that I may be misreading the error,  and that the JNDI/ 
JTA/JPA connection might be failing and just not generating any  
warnings or error. While I am a reasonably skilled programer I am far  
from a JAVA guru.
At this point I am begging for assistance with persistence I am not  
restricted to JPA as the solution it just seemed the most reasonable  
clustering solution for our environment with already having  
established an HA SQL server for our other apps on the same server.

-Andrew

On Jun 24, 2009, at 9:49 AM, Scott Battaglia wrote:

> You're confusing me. ;-)  What's the actual problem?  Last time you  
> said the tables hadn't been created now you're saying the dataource  
> isn't working.
>
>
>
>
> On Wed, Jun 24, 2009 at 9:44 AM, Andrew Tillinghast <[email protected] 
> > wrote:
> 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
>


-- 
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