2 Replies Latest reply on Feb 27, 2008 12:18 AM by Toni Beckman

    Upgrading to Seam 2.0.1 JBoss 4.2.2 GA

    Toni Beckman Novice

      Hi,


      I'm trying to move my webapplication from Seam 1.2.1 / JBoss 4.0.5 to Seam 2.0.1 / JBoss 4.2.2, but I'm experiencing great trouble with seam's managed persistence context (SMPC).


      If I try to inject the EntityManager into my SFSBs and if their scope is CONVERSATION scope, then I always get an EJBTransactionRolledbackException for no apparent reason.


      If I remove the following two lines from my SFSB, then the EJBTransactionRolledbackException is not raised anymore, but of course that does not help much:


        @In(create = true)
        EntityManager entityManager
      



      That's why I know that it's a problem with injecting seam's managed persistence context into the SFSBs. Unfortuanetly the Exception itself gives no further clues.


      What is interesting is, that I can inject the EnityManager, if I set the scope of the SFSB to SESSION. Then I can inject the EntityManager without any problems and use it, too.


      For example, the following code works fine:


      @Name("simpleAction")
      @Stateful
      // SESSION SCOPE IS OK! WHY CAN'T I USE CONVERSATION SCOPE?
      @Scope(ScopeType.SESSION) 
      
      public class SimpleAction implements BasicSimpleAction
      {
        @In(create = true)
        EntityManager entityManager;
      ...
      



      I really have no clue why this gives me trouble in Seam 2.0.1. I have checked all the configuration files many times today, and went through all the examples until I discovered that it's those two simple lines causing the woe.


      I appreciate any advice, because I really dont't know what to do anymore. I have scanned the server.log for errors and warnings and got this, which however, does not really help me either:


      2008-02-27 00:04:39,774 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:40,774 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:40,888 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:41,037 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:41,148 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:41,249 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:41,408 WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context 'null'
      2008-02-27 00:04:50,568 WARN  [org.hibernate.ejb.Ejb3Configuration] Defining hibernate.transaction.flush_before_completion=true ignored in HEM
      2008-02-27 00:04:54,389 WARN  [org.hibernate.impl.SessionFactoryObjectFactory] InitialContext did not implement EventContext
      2008-02-27 00:05:06,259 WARN  [org.jboss.seam.init.Initialization] Did not install PojoCache due to NoClassDefFoundError: org/jgroups/MembershipListener
      2008-02-27 00:05:50,356 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
      2008-02-27 00:05:51,128 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      2008-02-27 00:05:51,154 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      2008-02-27 00:05:51,161 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      2008-02-27 00:05:51,175 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      2008-02-27 00:05:51,189 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      2008-02-27 00:05:51,217 ERROR [STDERR] Feb 27, 2008 12:05:51 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      
      

        • 1. Re: Upgrading to Seam 2.0.1 JBoss 4.2.2 GA
          Nicklas Karlsson Master

          Could you post the whole stack trace where the EJBTransactionRolledbackException appears?


          Does the exception happen before you do anything or the first time it is used? Is it non-null after the injection? Can you access it from Contexts etc?

          • 2. Re: Upgrading to Seam 2.0.1 JBoss 4.2.2 GA
            Toni Beckman Novice


            Could you post the whole stack trace where the
            EJBTransactionRolledbackException appears?


            0:59:00,089 INFO  [Contexts] starting up: org.jboss.seam.security.identity
            00:59:00,094 INFO  [Contexts] starting up: org.jboss.seam.web.session
            00:59:01,082 ERROR [SeamPhaseListener] uncaught exception
            javax.el.ELException: javax.ejb.EJBTransactionRolledbackException
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                    at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
                    at org.jboss.seam.navigation.Page.preRender(Page.java:264)
                    at org.jboss.seam.navigation.Pages.preRender(Pages.java:309)
                    at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:549)
                    at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:460)
                    at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
                    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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                    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.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.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.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.ajp.AjpProcessor.process(AjpProcessor.java:437)
                    at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                    at java.lang.Thread.run(Thread.java:595)
            Caused by: javax.ejb.EJBTransactionRolledbackException
                    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                    at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                    at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
                    at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
                    at $Proxy148.update(Unknown Source)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                    at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                    at org.javassist.tmp.java.lang.Object_$$_javassist_1.update(Object_$$_javassist_1.java)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                    ... 46 more
            Caused by: java.lang.NullPointerException
                    at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.isRef(ManagedEntityIdentityInterceptor.java:140)
                    at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.entityRefsToIds(ManagedEntityIdentityInterceptor.java:91)
                    at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:51)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                    at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                    ... 80 more
            00:59:01,743 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
            00:59:01,768 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
            00:59:01,775 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
            00:59:01,790 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
            00:59:01,808 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
            00:59:01,814 ERROR [STDERR] Feb 27, 2008 12:59:01 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/opt/jboss-4.2.2.GA/server/default/deploy/calc.ear/calc.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xm
            




            Does the exception happen before you do anything or the first time it is used? Is it non-null after the injection? Can you access it from Contexts etc?


            Thanks, your question already helped.... I ran the debugger to find out.


            I set a breakpoint in the method, which gets call throug a page event shortly before the page is rendered.


            Interestingly the EntityManger gets injected and it is also being used to retrieve the entity beans. So everything is ok.


            So the exception is raised after the method is invoke. I have looked into the conversation using the debug.seam page and I also see the EntityManager there:


             class       class org.jboss.seam.persistence.ManagedPersistenceContext
            componentName      entityManager
            entityManager      org.jboss.seam.persistence.EntityManagerProxy@1779845
            entityManagerFactory      
            entityManagerFactoryFromJndiOrValueBinding      org.jboss.ejb3.entity.InjectedEntityManagerFactory@e8e1af
            filters      []
            persistenceUnitJndiName      java:/calcEntityManagerFactory
            toString()      ManagedPersistenceContext(java:/calcEntityManagerFactory)
            



            So I guess I'm further, knowing that it's not the injection of the EntityManager causing the problem.


            However, if I remove the SMPC or set the SFSB's scope to SESSION scope, then no exception is raised.


            Any other ideas ... that was already quite helpfull!