1 Reply Latest reply on Apr 3, 2007 9:16 AM by raffaele camanzo

    Conversation problem upgrading from 1.1.6 to 1.2.1GA

    francesco milesi Newbie

      Hi everybody,

      I have a problem upgrading from version 1.1.6 to 1.2.1GA.
      There is a part of the application that works perfectly with 1.1.6 and gives errors with 1.2.1GA.
      I have the following bean (I deleted from .java and .xhtml files all the unnecessary code and I left only what appears in this post, and still I have the same problem):


      @Name("machineManager")
      @Scope(ScopeType.CONVERSATION)
      @Transactional
      public class MachineManager extends ManagerBase {
       @Valid
       private Machine machine;
      
       @DataModel
       private List<KValue> mkValues;
      
      
       @Begin(id="#{machineManager.conversationId}", join=true, flushMode=FlushModeType.MANUAL)
       @Transactional
       public String start() {
       System.out.println(this + "->start-------->" + Contexts.getConversationContext());
       if(entityId > 0 && machine == null) {
       machine = getInstance();
       }
       else if(machine == null){
       machine = create();
       }
       return "";
       }
      
       public String getConversationId() {
       return "mch_" + entityId;
       }
      
      
      
       public Machine getInstance() {
       if(machine == null) {
       machine = entityManager.find(Machine.class, entityId);
       }
       return machine;
       }
      
      
       @Factory("mkValues")
       public void getMkValues() {
       if(mkValues == null) {
       mkValues = getInstance().getKValues();
       }
       }
      
      
       private Machine create() {
       Machine machine = new Machine();
       machine.setCompany(loginInfo.getCompany());
       machine.setPlant(loginInfo.getPlant());
       return machine;
       }
      
      }
      



      In the machine.page.xml I have

      <page action="#{machineManager.start}">
       <param name="entityId" value="#{machineManager.entityId}" />
      </page>
      


      In the /protected/machine/machine.xhtml I have the following code
      <ui:define name="body">
       <h:inputText value="#{machineManager.instance.code}"/>
       <s:link value="Kappas" view="/protected/machine/machine_kappas.xhtml" propagation="join" />
      </ui:define>
      

      where the s:link links to the following page (machine_kappas.xhtml) that contains a dataTable backed by the mkValues datamodel:

      <ui:define name="body">
       <h:form>
       <h:dataTable value="#{mkValues}"
       var="kappa">
       <h:column>
       #{kappa.name}
       </h:column>
       </h:dataTable>
      
       </h:form>
      </ui:define>
      


      When I click on the link in machine.xhtml to go to machine_kappas.xhtml, I get the following exception:

      GRAVE: Error Rendering View[/protected/machine/machine_kappas.xhtml]
      java.lang.NullPointerException
      at it.severn.beans.machine.MachineManager.getMkValues(MachineManager.java:212)
      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:20)
      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
      at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
      at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
      at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
      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.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
      at it.severn.beans.machine.MachineManager_$$_javassist_61.getMkValues(MachineManager_$$_javassist_61.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.seam.util.Reflections.invoke(Reflections.java:20)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
      at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1696)
      at org.jboss.seam.Component.getInstance(Component.java:1633)
      at org.jboss.seam.Component.getInstance(Component.java:1610)
      at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
      at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
      at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
      at com.sun.el.parser.AstGreaterThan.getValue(AstGreaterThan.java:41)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
      at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
      at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1075)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:231)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
      at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
      at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
      at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:222)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)


      What happens is that when I go to the machine_kappas.xhtml page the conversation does not contain anymore the data it was initialized with: machine is null, entityId is 0.... and so on. After the error, if I try to reload the machine.xhtml page from the link that should call the start method, I get the same error, the start method is not called anymore and the conversation is no more available.

      It looks very strange, because I do not think I did anything strange and with 1.1.6 all is working smoothly.
      Any idea about what is going on ?

      Many thanks as usual.

      Ciao Francesco


        • 1. Re: Conversation problem upgrading from 1.1.6 to 1.2.1GA
          raffaele camanzo Newbie

          Hi milesif,

          the problem you are facing is due to a misunderstanding of the Seam explicit conversation id feature, and it worked before the 1.2.1GA for a missing check. I know it very well because happened to me too, what you expect to do specifying:

          @Begin(id="", join=true)

          is wrong (better, not conforms to the Seam conversation management), because you want to switch between LRCs and this is not possible, indeed, you can start a new long running conversation *only* out of any other LRC.

          What happens now in your code (and you can see it watching the debug information of your server) is: Seam intercepts that you are trying to make concurrent calls and creates a temporary conversation and does not promote it at the end of the request... but trashes.

          If your design allows it, you can avoid it avoiding to propagate the conversation when you want to start a LRC in a way similar to:

          <s:link action="#{machineManager.start}" value="...">
           <s:conversationPropagation type="none" />
          </s:link>
          


          if you don't want to end the conversation you are in (none does not end the conversation you are leaving, then you can refer to that LRC later, but not arriving from a LRC :) ).

          Moreover, you should plan to migrate to the new business key way to define the explicit conversation ids in a natural way (this because id definition in the @Begin could be deprecated really soon), this is not officially released and undocumented, but if you want have a glance see:

          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033263

          Regards,
          Raffaele Camanzo