1 Reply Latest reply on Mar 13, 2007 6:05 PM by Greg Zoller

    Fun With Conversations and Persistence

    Greg Zoller Newbie

      Hello,

      I'm getting confused with something I think may be my mishandling of conversations. I have a DepartmentList.xhtml screen that has a commandButton that takes me to a DepartmentEdit.xhtml to create new Department entities. After creation I'm returned immediately to DepartmentList (no intermediate review page like the default seam-gen).

      The first time I create a Department it works great. If I immediately try create another Department I get exceptions on DepartmentEdit.xhtml. Sample exception dump below, but essentially it can't find properties of DepartmentHome. (I can cut the field its complaining about out of my screen and it will toss its lunch over another DepartmentHome field.)

      I show the code in DepartmentList.xhtml that links to DepartmentEdit.xhtml. I also show the save button code in DepartmentEdit.xhtml and included DepartmentEdit.page.xml.

      Thanks in advance for any clues.
      Greg

      Clip from DepartmentList.xhtml that links to DepartmentEdit.xhml

       <s:button view="/DepartmentEdit.xhtml"
       id="create"
       value="Create Department"/>
      


      DepartmentEdit.xhtml Control Buttons (rest of page is just display/edit fields)
       <!---- CLIP ---->
      
       <h:selectOneMenu value="#{departmentHome.instance.year}"
       rendered="#{!departmentHome.managed}"> <!-- (exception blew up here -->
       <f:selectItems value="#{main.yearRange}" />
       </h:selectOneMenu>
       <h:outputText value="#{departmentHome.instance.year}"
       rendered="#{departmentHome.managed}"/>
      
       <!---- CLIP ---->
      
       <h:commandButton id="save"
       value="Save"
       action="#{departmentHome.persist}"
       disabled="#{!departmentHome.wired}"
       rendered="#{!departmentHome.managed}"/>
      
       <h:commandButton id="update"
       value="Save"
       action="#{departmentHome.update}"
       rendered="#{departmentHome.managed}"/>
      
       <h:commandButton id="delete"
       value="Delete"
       action="#{departmentHome.remove}"
       rendered="#{departmentHome.managed and empty departmentHome.projects}"/>
       <s:button id="done"
       value="Done"
       view="/DepartmentList.xhtml"
       rendered="#{departmentHome.managed}"/>
      
       <s:button id="cancel"
       value="Cancel"
       propagation="end"
       view="/#{empty departmentFrom ? 'DepartmentList' : departmentFrom}.xhtml"
       rendered="#{!departmentHome.managed}"/>
      


      DepartmentEdit.page.xml
      <page no-conversation-view-id="/DepartmentList.xhtml"
       login-required="true">
      
       <begin-conversation join="true"/>
      
       <action execute="#{departmentHome.wire}"/>
      
       <param name="departmentFrom"/>
       <param name="departmentDeptId" value="#{departmentHome.departmentDeptId}"/>
      
       <navigation from-action="#{departmentHome.persist}">
       <end-conversation/>
       <redirect view-id="/DepartmentList.xhtml"/>
       </navigation>
      
       <navigation from-action="#{departmentHome.update}">
       <end-conversation/>
       <redirect view-id="/DepartmentList.xhtml"/>
       </navigation>
      
       <navigation from-action="#{departmentHome.remove}">
       <end-conversation/>
       <redirect view-id="/DepartmentList.xhtml"/>
       </navigation>
      
      </page>
      


      Sample Exceptions
      SEVERE: Error Rendering View[/DepartmentEdit.xhtml]
      javax.faces.el.EvaluationException: /DepartmentEdit.xhtml @32,49 rendered="#{!departmentHome.managed}": Exception getting value of property managed of base of type : com.paragon.spurs.model.DepartmentHome$$EnhancerByCGLIB$$8bf2ece8
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
       at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1075)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:189)
       at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
       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.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       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:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       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(Unknown Source)
      Caused by: javax.faces.el.EvaluationException: Bean: com.paragon.spurs.model.DepartmentHome$$EnhancerByCGLIB$$8bf2ece8, property: managed
       at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
       at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
       at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
       at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
       at com.sun.el.parser.AstNot.getValue(AstNot.java:46)
       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)
       ... 47 more
      Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
       ... 54 more
      Caused by: org.jboss.seam.framework.EntityNotFoundException: entity not found: com.paragon.spurs.model.Department#0
       at org.jboss.seam.framework.Home.handleNotFound(Home.java:100)
       at org.jboss.seam.framework.EntityHome.find(EntityHome.java:71)
       at org.jboss.seam.framework.Home.initInstance(Home.java:84)
       at org.jboss.seam.framework.Home.getInstance(Home.java:70)
       at org.jboss.seam.framework.EntityHome.isManaged(EntityHome.java:31)
       at org.jboss.seam.framework.EntityHome$$FastClassByCGLIB$$2a61cc01.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       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.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:154)
       at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:89)
       at com.paragon.spurs.model.DepartmentHome$$EnhancerByCGLIB$$8bf2ece8.isManaged(<generated>)
       ... 58 more
      11:20:33,511 WARN [Contexts] Could not destroy component: main
      javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: a2s2k-1240l5-ez8isic9-1-ez8isznu-6
       at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:268)
       at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.removeSession(StatefulRemoveInterceptor.java:127)
       at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:87)
       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:131)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       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:203)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy93.destroy(Unknown Source)
       at com.paragon.spurs.MainScreen$$FastClassByCGLIB$$c119f6cf.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:74)
       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.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
       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.intercept(ClientSideInterceptor.java:52)
       at com.paragon.spurs.MainScreen$$EnhancerByCGLIB$$a0d71168.destroy(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:121)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1802)
       at org.jboss.seam.Component.callDestroyMethod(Component.java:1733)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:230)
       at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:287)
       at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:45)
       at org.apache.catalina.session.StandardSession.expire(StandardSession.java:687)
       at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:579)
       at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
       at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
       at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
       at java.lang.Thread.run(Unknown Source)
      


        • 1. Re: Fun With Conversations and Persistence
          Greg Zoller Newbie

          Found it. Solution posted here for the next person who missed what I did.

          s:commandButton that launches DepartmentEdit.xhml needs to have a parameter. W/o this parameter strange things happen.

          Code should be:

           <s:button view="/DepartmentEdit.xhtml"
           id="create"
           value="Create Department"
           rendered="#{s:hasRole('ADMIN')}">
           <f:param name="departmentDeptId"/>
           </s:button>