7 Replies Latest reply on Jun 16, 2010 2:29 PM by Diego Coronel

    New conversations when injecting a non transient Conversation

    Diego Coronel Apprentice

      Hi,


      Im using Weld and i got some console errors when im trying to create a new conversation, the problem is when i  check conversation.isTransient() its true and its right. I dont want to end() current conversation, im trying to create a new conversation.begin( myConversationID ). Is it possible ? my scenario is that always when the user click on menuItem a want to create a new conversation and do not end current conversation.




      Caused by: java.lang.IllegalStateException: Attempt to call begin() on a long-running conversation
           at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:100)
           at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:117)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)



        • 1. Re: New conversations when injecting a non transient Conversation
          Nicklas Karlsson Master

          What version of weld? I recall a bug where the isTransient() went through a method which unfortunately checked too much, resulting in side-effects resembling the ones you mentioned.

          • 3. Re: New conversations when injecting a non transient Conversation
            Nicklas Karlsson Master

            SP4? Never even heard about that one ;-) Anyways, I think this is resolved in later versions/trunk.

            • 4. Re: New conversations when injecting a non transient Conversation
              Diego Coronel Apprentice

              Hi Nicklas,


              Ill try latest version from GlassfishV3 updates, and i got SP4 version from glassfish console, i searched i found this version from weld-osgi-bundle.jar/META-INF... it says 1.0.0(SP4) too, isnt this jar that i should look?

              • 5. Re: New conversations when injecting a non transient Conversation
                Diego Coronel Apprentice

                Hi Nicklas,


                I updated my glassfish and now my weld version is 1.0.1(SP3, again its showing on console). I cant create a new conversation yet... but my stacktrace changed:





                SEVERE: 'org.jboss.weld.exceptions.ForbiddenStateException' recebido ao invocar escuta de ação '#{menuController.menuListener}' para o componente 'j_idt45'
                SEVERE: org.jboss.weld.exceptions.ForbiddenStateException: WELD-000214 Attempt to call begin() on a long-running conversation
                     at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:114)
                     at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:132)
                     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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                     at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                     at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                     at org.jboss.weld.conversation.ConversationImpl_$$_javassist_15.begin(ConversationImpl_$$_javassist_15.java)
                     at br.mil.eb.framework.web.components.MenuController.menuListener(MenuController.java:71)
                     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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                     at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                     at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                     at br.mil.eb.framework.web.components.MenuController_$$_javassist_18.menuListener(MenuController_$$_javassist_18.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 com.sun.el.parser.AstValue.invoke(AstValue.java:234)
                     at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
                     at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
                     at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72)
                     at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
                     at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
                     at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
                     at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:772)
                     at javax.faces.component.UICommand.broadcast(UICommand.java:300)
                     at com.sun.faces.facelets.component.UIRepeat.broadcast(UIRepeat.java:863)
                     at com.sun.faces.facelets.component.UIRepeat.broadcast(UIRepeat.java:863)
                     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
                     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
                     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
                     at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
                     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
                     at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
                     at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
                     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
                     at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
                     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
                     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
                     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
                     at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
                     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
                     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
                     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
                     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
                     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
                     at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
                     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
                     at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
                     at java.lang.Thread.run(Thread.java:619)
                
                SEVERE: JSF1073: javax.faces.event.AbortProcessingException obtido durante o processamento de INVOKE_APPLICATION 5: UIComponent-ClientId=j_idt29:j_idt33, Message=/faces/template/menu.xhtml @61,41 actionListener="#{menuController.menuListener}": org.jboss.weld.exceptions.ForbiddenStateException: WELD-000214 Attempt to call begin() on a long-running conversation
                SEVERE: /faces/template/menu.xhtml @61,41 actionListener="#{menuController.menuListener}": org.jboss.weld.exceptions.ForbiddenStateException: WELD-000214 Attempt to call begin() on a long-running conversation
                javax.faces.event.AbortProcessingException: /faces/template/menu.xhtml @61,41 actionListener="#{menuController.menuListener}": org.jboss.weld.exceptions.ForbiddenStateException: WELD-000214 Attempt to call begin() on a long-running conversation
                     at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
                     at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
                     at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:772)
                     at javax.faces.component.UICommand.broadcast(UICommand.java:300)
                     at com.sun.faces.facelets.component.UIRepeat.broadcast(UIRepeat.java:863)
                     at com.sun.faces.facelets.component.UIRepeat.broadcast(UIRepeat.java:863)
                     at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
                     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
                     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
                     at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
                     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
                     at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
                     at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
                     at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
                     at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
                     at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
                     at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
                     at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
                     at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
                     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
                     at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
                     at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
                     at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
                     at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
                     at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
                     at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
                     at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
                     at java.lang.Thread.run(Thread.java:619)
                Caused by: org.jboss.weld.exceptions.ForbiddenStateException: WELD-000214 Attempt to call begin() on a long-running conversation
                     at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:114)
                     at org.jboss.weld.conversation.ConversationImpl.begin(ConversationImpl.java:132)
                     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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                     at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                     at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                     at org.jboss.weld.conversation.ConversationImpl_$$_javassist_15.begin(ConversationImpl_$$_javassist_15.java)
                     at br.mil.eb.framework.web.components.MenuController.menuListener(MenuController.java:71)
                     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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:304)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                     at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                     at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:298)
                     at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:113)
                     at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
                     at br.mil.eb.framework.web.components.MenuController_$$_javassist_18.menuListener(MenuController_$$_javassist_18.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 com.sun.el.parser.AstValue.invoke(AstValue.java:234)
                     at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
                     at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
                     at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72)
                     at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
                     at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
                     ... 35 more




                and thats my code:




                public void menuListener( ActionEvent event ) {
                          Long conversationId = null;
                          if ( !conversation.isTransient() ) {
                               conversationId = new Long( conversation.getId() );
                               conversationId++;
                          }
                          
                          if ( conversationId != null ) {
                               conversation.begin( conversationId + "" );
                          } else {
                               conversation.begin();
                          }
                     }



                • 6. Re: New conversations when injecting a non transient Conversation
                  Nicklas Karlsson Master

                  Well you call one conversation.begin() method in any case, regardless of the outomce of isTransient(), right?

                  • 7. Re: New conversations when injecting a non transient Conversation
                    Diego Coronel Apprentice

                    Yes, its right, ill always call begin, but if there is any conversation i want to call begin(newID). In my case i want to create a new conversation even if there is any long-runnning conversation. Its something like i always want my Menu creating a conversation to my functionalities. Is that possible ?