Make sure your config matches the docs, exactly by the letter. For instance, 
you want your entity manager to be called “entityManagerFactory”, and not 
“factoryBean”. 

- Misagh

> On Oct 20, 2015, at 4:46 AM, nico...@devels.es wrote:
> 
> Hi,
> 
> We just upgraded to CAS 4.1.1. When saving a service in the cas-management 
> webapp, the following exception is thrown:
> 
> 2015-10-20 12:34:57,509 ERROR 
> [org.jasig.cas.services.web.RegisteredServiceSimpleFormController] - 
> <javax.persistence.TransactionRequiredException: No transactional 
> EntityManager available
> java.lang.RuntimeException: javax.persistence.TransactionRequiredException: 
> No transactional EntityManager available
>       at 
> org.jasig.cas.services.web.RegisteredServiceSimpleFormController.saveService_aroundBody0(RegisteredServiceSimpleFormController.java:102)
>       at 
> org.jasig.cas.services.web.RegisteredServiceSimpleFormController$AjcClosure1.run(RegisteredServiceSimpleFormController.java:1)
>       at 
> org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
>       at 
> org.jasig.inspektr.aspect.TraceLogAspect.traceMethod(TraceLogAspect.java:44)
>       at 
> org.jasig.cas.services.web.RegisteredServiceSimpleFormController.saveService(RegisteredServiceSimpleFormController.java:85)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
>       at 
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
>       at 
> org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
>       at 
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
>       at 
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
>       at 
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
>       at 
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
>       at 
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
>       at 
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
>       at 
> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
>       at 
> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>       at 
> org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
>       at 
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>       at 
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
>       at 
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
>       at 
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
>       at 
> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
>       at 
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:162)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:120)
>       at 
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
>       at 
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
>       at 
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
>       at 
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>       at 
> org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
>       at 
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
>       at 
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
>       at 
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>       at 
> org.jasig.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:62)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>       at 
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
>       at 
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
>       at 
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
>       at 
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: javax.persistence.TransactionRequiredException: No transactional 
> EntityManager available
>       at 
> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:275)
>       at com.sun.proxy.$Proxy48.merge(Unknown Source)
>       at 
> org.jasig.cas.services.JpaServiceRegistryDaoImpl.save_aroundBody4(JpaServiceRegistryDaoImpl.java:58)
>       at 
> org.jasig.cas.services.JpaServiceRegistryDaoImpl$AjcClosure5.run(JpaServiceRegistryDaoImpl.java:1)
>       at 
> org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
>       at 
> org.jasig.inspektr.aspect.TraceLogAspect.traceMethod(TraceLogAspect.java:44)
>       at 
> org.jasig.cas.services.JpaServiceRegistryDaoImpl.save(JpaServiceRegistryDaoImpl.java:56)
>       at 
> org.jasig.cas.services.DefaultServicesManagerImpl.save_aroundBody10(DefaultServicesManagerImpl.java:147)
>       at 
> org.jasig.cas.services.DefaultServicesManagerImpl$AjcClosure11.run(DefaultServicesManagerImpl.java:1)
>       at 
> org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
>       at 
> org.jasig.inspektr.aspect.TraceLogAspect.traceMethod(TraceLogAspect.java:44)
>       at 
> org.jasig.cas.services.DefaultServicesManagerImpl.save(DefaultServicesManagerImpl.java:147)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>       at 
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
>       at 
> org.jasig.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:128)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
>       at 
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
>       at 
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
>       at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>       at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
>       at com.sun.proxy.$Proxy51.save(Unknown Source)
>       at 
> org.jasig.cas.services.web.RegisteredServiceSimpleFormController.saveService_aroundBody0(RegisteredServiceSimpleFormController.java:93)
>       ... 87 more
> 
> This worked so far at 4.1.0. Hibernate version is 4.3.10.Final, and the 
> configuration at managementConfigContext.xml is the following:
> 
>  <tx:annotation-driven />
> 
>  <bean id="factoryBean"
>        
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
>        p:dataSource-ref="dataSource"
>        p:jpaVendorAdapter-ref="jpaVendorAdapter"
>        p:packagesToScan-ref="packagesToScan">
>      <property name="jpaProperties">
>        <props>
>          <prop key="hibernate.dialect">${database.hibernate.dialect}</prop>
>          <prop key="hibernate.hbm2ddl.auto">update</prop>
>          <prop 
> key="hibernate.jdbc.batch_size">${database.hibernate.batchSize:10}</prop>
>        </props>
>      </property>
>  </bean>
> 
>  <util:list id="packagesToScan">
>      <value>org.jasig.cas.services</value>
>      <value>org.jasig.cas.ticket</value>
>      <value>org.jasig.cas.adaptors.jdbc</value>
>  </util:list>
> 
>  <bean id="jpaVendorAdapter"
>        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
>        p:generateDdl="true"
>        p:showSql="true" />
> 
>  <bean id="serviceRegistryDao"
>        class="org.jasig.cas.services.JpaServiceRegistryDaoImpl" />
> 
>  <bean id="transactionManager"
>        class="org.springframework.orm.jpa.JpaTransactionManager"
>        p:entityManagerFactory-ref="factoryBean" />
> 
>  <bean 
> class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
>  />
> 
>  <bean
>        id="dataSource"
>        class="org.apache.commons.dbcp.BasicDataSource"
>        p:driverClassName="${database.driverClass}"
>        p:url="${database.url}"
>        p:password="${database.password}"
>        p:username="${database.user}" />
> 
> Any hint? If needed, I can provide DEBUG level logs.
> 
> Thanks.
> 
> -- 
> You are currently subscribed to cas-user@lists.jasig.org as: 
> mmoay...@unicon.net
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user


-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to