2 Replies Latest reply on Aug 20, 2008 11:42 PM by Binesh Gummadi

    seam managed transactions

    Binesh Gummadi Novice

      We have a seam/hibernate/mysql app. Application worked fine until we switched mysql engine from MyISAM to InnoDB. Data is not persisted any more with InnoDB. InnoDB works with transactions and I configured transactions in component.xml.


      I already have these two lines


      <persistence:hibernate-session-factory name="hibernateSessionFactory" />
      <persistence:managed-hibernate-session name="session" auto-create="true" session-factory jndi-name="java:/myProjectSessionFactory" />
      


      I added


      <transaction:hibernate-transaction session="#{session}"/>



      When I run my app with the above setting, I get this error


      java.lang.IllegalStateException: Could not start transaction
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:592)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:323)
           at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:140)
           at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
           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.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           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:147)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           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 com.trendy.view.filters.PerfMonFilter.doFilter(PerfMonFilter.java:31)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:613)
      Caused by: java.lang.ClassCastException: org.apache.catalina.session.StandardSessionFacade
           at org.jboss.seam.transaction.HibernateTransaction.initSession(HibernateTransaction.java:69)
           at org.jboss.seam.transaction.HibernateTransaction.begin(HibernateTransaction.java:80)
           at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:587)



        • 1. Re: seam managed transactions
          Binesh Gummadi Novice

          I think it is a class loader issue. I am debugging more and will update my findings.
          But if you have solved this before please let me know. Also let me know if I am barking at the wrong tree. :-)

          • 2. Re: seam managed transactions
            Binesh Gummadi Novice

            WOW! I cannot believe this but I had to change the name of my managed-hibernate-session from session to something else. I thought it was a class loader issue but after reading error more carefully, ClassCastException is for org.apache.catalina.session.StandardSessionFacade and org.hibernate.Session. It looks like one is a web session and the other is hibernate session. I cannot answer what is happening but when I changed the name it started working fine now.


            Could it be that web session object is outjected into seam context with the same name? I don't know. Just guessing.