1 Reply Latest reply on Jan 29, 2009 11:22 PM by Ging Ming Chan

    Endless redirect loop using spring:transaction and JpaTransactionManager

    Darryl Smith Newbie

      Endless redirect loop using spring:transaction and JpaTransactionManager


      When JpaTransactionManager can't obtain a connection to the database (e.g. its offline)
      Seam will endlessly redirect to loop


      Loop is something like this
      ExceptionFilter to PhaseListener to ExceptionFilter to send redirect to error page to .... loop ....


      Of coarse this creates a major issue when you database is offline, users will never see a error page


      Should I raise a JIRA issue?


      12/06 13:20:34.797 WARN  org.jboss.seam.exception.Exceptions -  - handled and logged exception
      java.lang.IllegalStateException: Could not start transaction
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:599) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:584) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:325) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) [jsf-impl-1.2_10.jar:1.2_10-b01-FCS]
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) [jsf-impl-1.2_10.jar:1.2_10-b01-FCS]
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_10.jar:1.2_10-b01-FCS]
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_10.jar:1.2_10-b01-FCS]
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) [catalina.jar:na]
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) [catalina.jar:na]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507) [richfaces-impl-3.2.2.GA.jar:3.2.2.GA]
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) [catalina.jar:na]
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) [catalina.jar:na]
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) [catalina.jar:na]
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) [catalina.jar:na]
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) [catalina.jar:na]
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:na]
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) [catalina.jar:na]
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) [catalina.jar:na]
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) [catalina.jar:na]
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) [tomcat-http.jar:na]
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) [tomcat-http.jar:na]
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) [tomcat-util.jar:5.1]
           at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) [tomcat-util.jar:5.1]
           at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) [tomcat-util.jar:5.1]
           at java.lang.Thread.run(Thread.java:595) [na:1.5.0_13]
      Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
           at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:375) [spring-2.5.5.jar:2.5.5]
           at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377) [spring-2.5.5.jar:2.5.5]
           at org.jboss.seam.ioc.spring.SpringTransaction.begin(SpringTransaction.java:67) [jboss-seam-ioc-2.1.0.SP1.jar:2.1.0.SP1]
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:594) [jboss-seam-2.1.0.SP1.jar:2.1.0.SP1]
           ... 43 common frames omitted
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
           at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637) [hibernate-entitymanager-3.3.2.GA.jar:3.3.2.GA]
           at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:41) [hibernate-entitymanager-3.3.2.GA.jar:3.3.2.GA]
           at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:70) [spring-2.5.5.jar:2.5.5]
           at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:330) [spring-2.5.5.jar:2.5.5]
           ... 46 common frames omitted

        • 1. Re: Endless redirect loop using spring:transaction and JpaTransactionManager
          Ging Ming Chan Newbie

          May I know what is the status for this?  I've the same problem with endless redirect loop to the error.seam page.  However, I've using the Tomcat JNDI Datasource, not the Spring transaction.


          java.lang.IllegalStateException: Could not start transaction
               at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:599)
               at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:584)
               at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:325)
               at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
               at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
               at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
               at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
               at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
               at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
               at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
               at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
               at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
               at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
               at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
               at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
               at java.lang.Thread.run(Thread.java:595)
          Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
               at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
               at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:41)
               at org.jboss.seam.transaction.EntityTransaction.begin(EntityTransaction.java:82)
               at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:594)
               ... 45 more