1 2 Previous Next 15 Replies Latest reply on Jun 19, 2007 6:50 AM by lcoetzee

    SeamExtendedManagedPersistencePhaseListener ?

    lcoetzee

      Hi,

      I am tracking Seam's CVS. Some changes done very recently (over the weekend or Friday 15/06/2007) is creating some weird things.

      I see that there is no more SeamExtendedManagedPersistencePhaseListener. I have taken that out from my faces-config.xml. I assume that the normal SeamPhaseListener will do al of these things automatically. However, since I have taken it out I get the following exception:

      12:37:09,956 ERROR [SeamPhaseListener] uncaught exception
      java.lang.NullPointerException
       at org.jboss.seam.persistence.HibernatePersistenceProvider.getVersion(HibernatePersistenceProvider.java:62)
       at org.jboss.seam.contexts.PassivatedEntity.createPassivatedEntity(PassivatedEntity.java:129)
       at org.jboss.seam.contexts.EntityBeanList.clearDirty(EntityBeanList.java:57)
       at org.jboss.seam.contexts.Lifecycle.isAttributeDirty(Lifecycle.java:576)
       at org.jboss.seam.contexts.ServerConversationContext.flush(ServerConversationContext.java:242)
       at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:478)
       at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:341)
       at org.jboss.seam.jsf.SeamPhaseListener.afterRender(SeamPhaseListener.java:513)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:183)
       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.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:70)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:62)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
       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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:853)
       at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
       at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1513)
       at java.lang.Thread.run(Thread.java:619)
      



      Looking at the Seam example I see that they use
      @PersistenceContext(type=EXTENDED)
       private EntityManager em;
      


      while I use
       @In(create = true, value = "napEntityManager")
       private EntityManager em;
      


      Is the above part of my problem ?

      Regards

      Louis


        • 1. Re: SeamExtendedManagedPersistencePhaseListener ?
          gavin.king

          You no longer need to declare any phaselisteners explicitly.

          Thanks for spotting that bug, it is now fixed in CVS. Please test the fix for me, thanks.

          • 2. Re: SeamExtendedManagedPersistencePhaseListener ?
            lcoetzee

            I have tested and seems to be working. Thanks.

            However, the following exception has cropped up (from functionality that did work previously).

            I will look into it a bit more to see if I can see what is going on.

            L


            2007-06-18 18:32:27,210 ERROR [csir.content.management.seam.ContentManagementBean] Failed to persist content
            javax.ejb.EJBTransactionRolledbackException: current database version number does not match passivated version number
             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:76)
             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:106)
             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:204)
             at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
             at $Proxy149.theBegin(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:597)
             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:72)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
             at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
             at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
             at org.javassist.tmp.java.lang.Object_$$_javassist_102.theBegin(Object_$$_javassist_102.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:597)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
             at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
             at org.jboss.seam.Component.callComponentMethod(Component.java:1919)
             at org.jboss.seam.Component.callCreateMethod(Component.java:1842)
             at org.jboss.seam.Component.newInstance(Component.java:1831)
             at org.jboss.seam.Component.getInstance(Component.java:1728)
             at org.jboss.seam.Component.getInstance(Component.java:1695)
             at org.jboss.seam.core.Events.raiseEvent(Events.java:73)
             at csir.content.management.seam.ContentManagementBean.save(ContentManagementBean.java:1215)
             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:597)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
             at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
             at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
             at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:42)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:30)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
             at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
             at sun.reflect.GeneratedMethodAccessor183.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             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.invokeInOurTx(TxPolicy.java:79)
             at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:253)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
             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:106)
             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:204)
             at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
             at $Proxy161.save(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:597)
             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:72)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
             at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
             at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
             at org.javassist.tmp.java.lang.Object_$$_javassist_99.save(Object_$$_javassist_99.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:597)
             at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
             at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
             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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
             at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
             at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
             at javax.faces.component.UICommand.broadcast(UICommand.java:383)
             at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
             at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
             at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
             at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
             at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:70)
             at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
             at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
             at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
             at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
             at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:62)
             at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
             at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
             at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
             at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
             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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
             at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:853)
             at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
             at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1513)
             at java.lang.Thread.run(Thread.java:619)
            


            • 3. Re: SeamExtendedManagedPersistencePhaseListener ?
              gavin.king

              Put a breakpoint on that exception, and look at what Seam thinks the version numbers are.

              Perhaps you are using Dates for version numbers? Hmmmm I guess equals() won't work in that case, and I need something more sophisticated....

              • 4. Re: SeamExtendedManagedPersistencePhaseListener ?
                lcoetzee

                Seam thinks that the version numbers are different.... (the values of the versions). These values do not correlate with the version value in the database (8910 and 8904 with 1 in the db).

                I am using :

                 private Integer version;
                
                 @Version
                 public Integer getVersion() {
                 return version;
                 }
                


                There is a few other things that also pop up .. especially with checkboxes. I will look into it a bit tomorrow and give feedback as well.


                • 5. Re: SeamExtendedManagedPersistencePhaseListener ?
                  lcoetzee

                  Hmm.. something else... my method where this happens (save) is annotated with a

                  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)


                  and the sfsb with
                  @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)


                  Dont know if that might give some insight.

                  L


                  • 6. Re: SeamExtendedManagedPersistencePhaseListener ?
                    gavin.king

                    Oh, yeah, that totally gives me insight.

                    Tell me something: are you using a seam-managed persistence context from inside a REQUIRES_NEW session bean?

                    Naughty-naughty :-)

                    • 7. Re: SeamExtendedManagedPersistencePhaseListener ?
                      lcoetzee

                      Jip... this is what we have:

                      @In(create = true, value = "napEntityManager")
                       EntityManager em;
                      


                      We do all sorts of things (e.g. sometimes we have to evict a touched entity)...

                      L

                      • 8. Re: SeamExtendedManagedPersistencePhaseListener ?
                        gavin.king

                        OK, thats definitely Bad.

                        You should always use @PersistenceContext inside a REQUIRES_NEW bean, and get a container-managed PC.

                        The Seam-managed PC is associated with the outer (suspended) tx managed by Seam. You shouldn't associate it with a new one. Its only allowed to be associated with one transaction at a time.

                        I wish there was an easy way for me to detect cases like this, but its actually very difficult, because all I have is a UserTransaction, and no Transaction.

                        • 9. Re: SeamExtendedManagedPersistencePhaseListener ?
                          lcoetzee

                          Aahh.. makes sense.

                          I will change it tomorrow and give feedback.

                          • 10. Re: SeamExtendedManagedPersistencePhaseListener ?
                            gavin.king

                            I just committed some further changes to this code.

                            I would appreciate it if you could test out the latest rev...

                            • 11. Re: SeamExtendedManagedPersistencePhaseListener ?
                              lcoetzee

                              A new day ;-)

                              I have changed my EntityManager to be container managed:

                              @PersistenceContext(type=PersistenceContextType.EXTENDED, name="napEntityManager")
                               EntityManager em;


                              I now get the following:
                              2007-06-19 09:29:04,036 ERROR [csir.content.management.seam.ContentManagementBean] Failed to persist content
                              javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: csir.content.par.RainbowContent
                               at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
                               at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
                               at org.jboss.ejb3.entity.ExtendedEntityManager.persist(ExtendedEntityManager.java:101)
                               at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:128)
                               at csir.content.management.seam.ContentManagementBean.save(ContentManagementBean.java:1191)
                               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:597)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                               at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                               at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                               at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                               at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:42)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                               at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:30)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                               at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                               at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
                               at sun.reflect.GeneratedMethodAccessor183.invoke(Unknown Source)
                               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                               at java.lang.reflect.Method.invoke(Method.java:597)
                               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:71)
                               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.invokeInOurTx(TxPolicy.java:79)
                               at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:253)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                               at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                               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:106)
                               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:204)
                               at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
                               at $Proxy161.save(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:597)
                               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:72)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                               at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
                               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                               at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
                               at org.javassist.tmp.java.lang.Object_$$_javassist_97.save(Object_$$_javassist_97.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:597)
                               at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
                               at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
                               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 com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                               at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
                               at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
                               at javax.faces.component.UICommand.broadcast(UICommand.java:383)
                               at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
                               at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
                               at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                               at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                               at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:70)
                               at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
                               at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
                               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
                               at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
                               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:62)
                               at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
                               at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
                               at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56)
                               at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127)
                               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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                               at java.lang.Thread.run(Thread.java:619)
                              


                              This "detached entity" is actually something that I am Inning:
                              @In(create = false, required = false)
                               @Out(required = false)
                               RainbowContent rainbowContent;
                              


                              Regards

                              L


                              • 12. Re: SeamExtendedManagedPersistencePhaseListener ?
                                gavin.king

                                You cant call persist() on a detached object dude.

                                It has to be something you got with new.

                                • 13. Re: SeamExtendedManagedPersistencePhaseListener ?
                                  lcoetzee

                                  I will check it, but this is code that has worked with all the Seam CVS's prior to the weekend. My feeling is that, that detatched thing would have popped earlier.

                                  L

                                  • 14. Re: SeamExtendedManagedPersistencePhaseListener ?
                                    gavin.king

                                    No this is the kind of thing that can happen when you pass an object from one persistence context to a different one.

                                    1 2 Previous Next