Patched. Much appreciated.
From: cas-user@apereo.org [mailto:cas-user@apereo.org] On Behalf Of Daniel Frett Sent: Saturday, December 26, 2015 4:22 PM To: CAS Community <cas-user@apereo.org> Cc: jasig-cas-u...@googlegroups.com; mmoay...@unicon.net Subject: Re: [cas-user] 4.1.2: JpaTicketRegistry: No transactional EntityManager available The patch Misagh introduced in 4.1.3 caused a different issue once the backing database connection timed out. I have tracked down what the missing transactional config was for 4.1.x and added it to the documentation. The JpaTicketRegistry transactional config for 4.1.x should include all of the following pointcuts/advice: <tx:advice id="txCentralAuthenticationServiceAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="destroyTicketGrantingTicket" read-only="false" /> <tx:method name="grantServiceTicket" read-only="false" /> <tx:method name="delegateTicketGrantingTicket" read-only="false" /> <tx:method name="validateServiceTicket" read-only="false" /> <tx:method name="createTicketGrantingTicket" read-only="false" /> <tx:method name="getTicket" read-only="true" /> <tx:method name="getTickets" read-only="true" /> </tx:attributes> </tx:advice> <tx:advice id="txRegistryAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="deleteTicket" read-only="false" /> <tx:method name="addTicket" read-only="false" /> <tx:method name="updateTicket" read-only="false" /> <tx:method name="getTicket" read-only="true" /> <tx:method name="getTickets" read-only="true" /> <tx:method name="sessionCount" read-only="true" /> <tx:method name="serviceTicketCount" read-only="true" /> </tx:attributes> </tx:advice> <tx:advice id="txRegistryServiceTicketDelegatorAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="grantTicketGrantingTicket" read-only="false" /> </tx:attributes> </tx:advice> <tx:advice id="txRegistryTicketGrantingTicketDelegatorAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="markTicketExpired" read-only="false" /> <tx:method name="grantServiceTicket" read-only="false" /> </tx:attributes> </tx:advice> <tx:advice id="txRegistryLockingAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="getOwner" read-only="true" /> <tx:method name="acquire" read-only="false" /> <tx:method name="release" read-only="false" /> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="ticketRegistryOperations" expression="execution(* org.jasig.cas.ticket.registry.JpaTicketRegistry.*(..))"/> <aop:pointcut id="ticketRegistryLockingOperations" expression="execution(* org.jasig.cas.ticket.registry.support.JpaLockingStrategy.*(..))"/> <aop:pointcut id="ticketRegistryServiceTicketDelegatorOperations" expression="execution(* org.jasig.cas.ticket.registry.AbstractDistributedTicketRegistry$ServiceTicketDelegator.*(..))"/> <aop:pointcut id="ticketRegistryTicketGrantingTicketDelegatorOperations" expression="execution(* org.jasig.cas.ticket.registry.AbstractDistributedTicketRegistry$TicketGrantingTicketDelegator.*(..))"/> <aop:pointcut id="casOperations" expression="execution(* org.jasig.cas.CentralAuthenticationServiceImpl.*(..))"/> <aop:advisor advice-ref="txRegistryAdvice" pointcut-ref="ticketRegistryOperations"/> <aop:advisor advice-ref="txRegistryLockingAdvice" pointcut-ref="ticketRegistryLockingOperations"/> <aop:advisor advice-ref="txRegistryTicketGrantingTicketDelegatorAdvice" pointcut-ref="ticketRegistryTicketGrantingTicketDelegatorOperations"/> <aop:advisor advice-ref="txRegistryServiceTicketDelegatorAdvice" pointcut-ref="ticketRegistryServiceTicketDelegatorOperations"/> <aop:advisor advice-ref="txCentralAuthenticationServiceAdvice" pointcut-ref="casOperations"/> </aop:config> This is only the configuration for the JpaTicketRegistry and does NOT include pointcuts/advice for the JpaServiceRegistryDaoImpl. Relevant github issue/PRs: https://github.com/Jasig/cas/issues/1378 https://github.com/Jasig/cas/pull/1386 I have tested out the updated config on the sample webapp Jean provided here: https://github.com/jlorieux/cas-jpaTicket and verified it works just putting the updated config in place. -Daniel On Wednesday, December 9, 2015 at 4:33:40 AM UTC-5, Jean Lorieux wrote: Thank you very much. I tried your patch and it is working fine on my side. On Monday, December 7, 2015 at 7:29:46 PM UTC+1, Misagh Moayyed wrote: This turned out to be a bug with the entity manager prematurely closing. This will be fixed in 4.1.3; You can try to test this with 4.1.3 SNAPSHOT for the time being until it’s released in a couple of weeks. From: cas-...@apereo.org <mailto:cas-...@apereo.org> [mailto:cas-...@apereo.org] On Behalf Of Jean L. Sent: Sunday, December 6, 2015 3:18 PM To: jasig-cas-user <jasig-c...@googlegroups.com <mailto:jasig-c...@googlegroups.com> > Cc: cas-...@apereo.org <mailto:cas-...@apereo.org> Subject: Re: [cas-user] 4.1.2: JpaTicketRegistry: No transactional EntityManager available Hi, I have the same "No transactional EntityManager available" issue on my side, with a simple JPA Ticket registry (and JSON Service registry). I have also added a minimal GH project to help reproducing the issue: https://github.com/jlorieux/cas-jpaTicket In my case, the TGT ticket is successfully created in the database, but not the ST ticket ("No transactional EntityManager available" occurs before). I'm using a MySQL 5.5/Tomcat 8 backend. Regards, Jean L. On Sunday, December 6, 2015 at 1:49:17 PM UTC+1, Robert Oschwald wrote: Misagh, I added a sample overlay project on GH with JPA Ticket+Service registry config (using a shared TransactionManager in this case). I receive the same error as in my project: org.hibernate.hql.internal.ast.QuerySyntaxException: AbstractRegisteredService is not mapped Here it is: https://github.com/robertoschwald/jasig-cas-examples-robertoschwald/tree/4.1.2_jpa Note: The Master branch holds a default overlay config using in-memory (which works and was the base for the JPA config example in 4.1.2_jpa). Config was done as described in http://jasig.github.io/cas/4.1.x/installation/JPA-Ticket-Registry.html and http://jasig.github.io/cas/4.1.x/installation/Service-Management.html#registered-services See comment at line 153 in deployerConfigContext of cas-server-overlay. Please have a look. Thanks! Robert > Am 02.12.2015 um 19:12 schrieb Misagh Moayyed <mmoa...@unicon.net > <mailto:mmoa...@unicon.net> >: > > I ran a quick test, with both JPA service registry and JPA ticket registry > defined in an overlay using the same transaction manager. No issues. > > Post your overlay somewhere on github or pastebin and we might be able to > spot something. Otherwise so far, it’s more likely a config issue on your > end. > > - Misagh > >> On Dec 1, 2015, at 10:15 PM, Tai Hu <hut...@gmail.com >> <mailto:hut...@gmail.com> > wrote: >> >> Do you find the solution for this "No transactional EntityManager >> available" issue? I just ran into the exact same problem. For both >> PostgreSQL and MySQL, merge method is never under a transaction. Thanks. >> >> On Monday, November 30, 2015 at 7:48:05 AM UTC-5, robertoschwald wrote: >> Hi all, >> >> while configuring CAS 4.1.2 with JpaTicketRegistry, I cannot get it to >> work. >> I always receive the following Exception: >> Exception thrown executing >> org.jasig.cas.web.flow.GenerateServiceTicketAction@6e6a43a4 >> <mailto:org.jasig.cas.web.flow.GenerateServiceTicketAction@6e6a43a4> in >> state 'generateServiceTicket' of flow 'login' >> javax.persistence.TransactionRequiredException: No transactional >> EntityManager available >> at >> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:275) >> at com.sun.proxy.$Proxy49.merge(Unknown Source) >> at >> org.jasig.cas.ticket.registry.JpaTicketRegistry.updateTicket(JpaTicketRegistry.java:57) >> >> >> I used the described config in >> http://jasig.github.io/cas/4.1.x/installation/JPA-Ticket-Registry.html >> and also added some pointcuts described in >> >> http://stackoverflow.com/a/33663812 >> >> But it still fails. >> >> My JPA config is in spring-configuration/ticketRegistry.xml. >> >> Anything else I’m missing? >> >> >> Robert >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "CAS Community" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cas-user+u...@apereo.org <mailto:cas-user+u...@apereo.org> . >> Visit this group at >> http://groups.google.com/a/apereo.org/group/cas-user/. > > > -- > You received this message because you are subscribed to the Google Groups > "CAS Community" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cas-user+u...@apereo.org <mailto:cas-user+u...@apereo.org> . > Visit this group at http://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org <mailto:cas-user+u...@apereo.org> . Visit this group at http://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org <mailto:cas-user+u...@apereo.org> . Visit this group at http://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org <mailto:cas-user+u...@apereo.org> . Visit this group at http://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscr...@apereo.org <mailto:cas-user+unsubscr...@apereo.org> . Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/. -- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscr...@apereo.org. Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.