3 Replies Latest reply on Jul 12, 2007 3:32 AM by Przemyslaw Jaskierski

    @Transactional + Transaction.setRollbackOnly error

    Przemyslaw Jaskierski Newbie

      Env: Tomcat 6.0.13, Hibernate local transactions, Seam CVS 11/07.

      As @Rollback(ifOutcome) had been removed ,usage of Trancation.instance(),setRollbackOnly() was introduced instead.

      Before (1.3 + Rollback) such pseudocode was working (long-running conversation with manual flush mode). Am I doing something
      totally wrong and such thing is expected (stacktrace below),
      or is it an error?

      @Transactional
      @Rollback(ifOutcome="GOBACK")//now removed for Seam2
      methodCalledFromJPDLPageflow()
      {
       doALotWithSession();
       for (everyElementThatUserProvidedInCoversation) {
       try {
       doSomethingThatCanFireException();
       } catch (NastyException) {
       createErrorFacesMessageEtcForElement();
       addToInvalidElementsCollection();
       errorAppeared = true;
       }
       }
      
       if (errorAppeared) {
       prepareUserReportForInvalidElementsCollection();
      
      --> Transaction.instance.setRollbackOnly();
       return "GOBACK";
       }
      
       session.flush, etc, etc...
      }
      


      Here yon see corresponding logs and exceptions... BTW another
      strange thing is this "cannot render message" thing from
      JSF RI, because it was working before as there is
      <a4j:outputPanel id="messagesTop">
      <h:messages/>
      </a4j:outputPanel>

      on the page.

      * 2007-07-11 20:58:53,262 DEBUG HibernateTransaction.begin():77
       beginning Hibernate transaction
      * 2007-07-11 20:58:53,317 DEBUG HibernateTransaction.registerSynchronization():181
       registering synchronization: ManagedHibernateSession(java:/seamManagedHibernateSession)
      * 2007-07-11 20:59:01,152 DEBUG HibernateTransaction.setRollbackOnly():122
       marking Hibernate transaction for rollback
      * 2007-07-11 20:59:01,155 DEBUG HibernateTransaction.rollback():112
       rolling back Hibernate transaction
      Jul 11, 2007 8:59:01 PM com.sun.faces.lifecycle.RenderResponsePhase execute
      INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=null[severity=(INFO 0), summary=(Nie ma wystarczaj?cej ilo?ci niektórych zamówionych przedmiotów, szczegó?y podano poni?ej.), detail=(Nie ma wystarczaj?cej ilo?ci niektórych zamówionych przedmiotów, szczegó?y podano poni?ej.)]
      sourceId=null[severity=(WARN 1), summary=(Transaction failed), detail=(Transaction failed)]
      * 2007-07-11 20:59:01,218 DEBUG HibernateTransaction.rollback():112
       rolling back Hibernate transaction
      * 2007-07-11 20:59:01,218 ERROR SeamPhaseListener.afterPhase():189
       uncaught exception
      java.lang.IllegalStateException: Could not commit transaction
       at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:589)
       at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       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.web.MultipartFilter.doFilter(MultipartFilter.java:87)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:70)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(GzipFilter.java:75)
       at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:92)
       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:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalStateException: transaction is not active
       at org.jboss.seam.transaction.HibernateTransaction.assertActive(HibernateTransaction.java:163)
       at org.jboss.seam.transaction.HibernateTransaction.rollback(HibernateTransaction.java:114)
       at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:584)
       ... 40 more
      * 2007-07-11 20:59:01,222 ERROR DebugPageHandler.handle():23
       redirecting to debug page
      java.lang.IllegalStateException: transaction is not active
       at org.jboss.seam.transaction.HibernateTransaction.assertActive(HibernateTransaction.java:163)
       at org.jboss.seam.transaction.HibernateTransaction.rollback(HibernateTransaction.java:114)
       at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:584)
       at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       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.web.MultipartFilter.doFilter(MultipartFilter.java:87)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:40)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:70)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at net.sf.ehcache.constructs.web.filter.GzipFilter.doFilter(GzipFilter.java:75)
       at net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:92)
       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:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      * 2007-07-11 20:59:01,235 DEBUG HibernateTransaction.begin():77
       beginning Hibernate transaction
      * 2007-07-11 20:59:01,245 DEBUG HibernateTransaction.registerSynchronization():181
       registering synchronization: ManagedHibernateSession(java:/seamManagedHibernateSession)
      Jul 11, 2007 8:59:01 PM com.sun.faces.lifecycle.RenderResponsePhase execute
      INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=null[severity=(WARN 1), summary=(Illegal navigation), detail=(Illegal navigation)]
      * 2007-07-11 20:59:01,277 DEBUG HibernateTransaction.commit():94
       committing Hibernate transaction
      


      Regards,
      Przemek.