6 Replies Latest reply on Oct 12, 2007 10:03 AM by pmuir

    @In(required = false,value=

    lcoetzee

      Hi,

      this with reference to:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121008

      I have two beans: questionnaireManagementBean which outjects a DataModel :

      @DataModel
       private List<Section> sections;


      and renders an jsf page. From the JSF page two actions can be executed (on the second bean), (a) where an item in the list is selected and (b) where no item is selected.

      A second bean (sectionManagementBean) injects the "datamodel" with:
      @In("#{sections.wrappedData}")
       private List<Section> sections;
       @In(required = false,value="#{sections.rowData}")
       @Out(required = false, scope = ScopeType.CONVERSATION)
       private Section section;


      Option (a) works (when an item is selected, which then gets injected and used). Option (b) however breaks, where it is still trying to inject the sections.rowData, thus not honoring the "required=false" in the @In.


      javax.ejb.EJBTransactionRolledbackException: Error reading 'rowData' on type org.jboss.seam.jsf.ListDataModel
       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 $Proxy194.beanBegin(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: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:106)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
       at org.javassist.tmp.java.lang.Object_$$_javassist_26.beanBegin(Object_$$_javassist_26.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:125)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2087)
       at org.jboss.seam.Component.callCreateMethod(Component.java:2010)
       at org.jboss.seam.Component.newInstance(Component.java:1981)
       at org.jboss.seam.Component.getInstance(Component.java:1878)
       at org.jboss.seam.Component.getInstance(Component.java:1845)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
       at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
       at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
       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
       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.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       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:44)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       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:157)
       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)
      Caused by: javax.el.ELException: Error reading 'rowData' on type org.jboss.seam.jsf.ListDataModel
       at javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
       at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
       at org.jboss.seam.Component.getValueToInject(Component.java:2130)
       at org.jboss.seam.Component.injectAttributes(Component.java:1603)
       at org.jboss.seam.Component.inject(Component.java:1421)
       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
       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:106)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
       at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source)
      
      
      


      Any suggestions ?

      Regards

      Louis

        • 1. Re: @In(required = false,value=
          lcoetzee

          Oops.. title should have read:

          @In(required = false,value="#{sections.rowData}") issues


          L


          • 2. Re: @In(required = false,value=
            pmuir

            So probably the solution is to lazy load the injection on request using Expressions.getInstance().createValueExpression("#{sections.rowData}", Foo.class).getValue();

            • 3. Re: @In(required = false,value=
              lcoetzee

              Pete,

              that is very very cute !!! Works nicely. Thanks.

              Another way (using the old approach combined with this new method) which works as well is:

              @In(required = false,value="#{sections.rowIndex}")
               private int selectedSectionIndexNr;
              
              
               public String selectSection() {
               section = sections.get(selectedSectionIndexNr);
               questions = section.getQuestions();
               return "selectedSection";
               }


              A follow up question, related to my usage of 1 Datatable over two SFSB's:

              With regard to accessing a datatable in two SFSB's... if an item is added to the sections in sectionManagementBean (as injected as shown earlier in sectionManagementBean), it appears as if those changes are not propagated back to the initial bean (questionnaireManagementBean) even though it is still in the same conversation.

              Almost as if the Datamodel is not re-outjected.

              Is that the intended behavior ?

              L




              • 4. Re: @In(required = false,value=
                pmuir

                Yes, @DataModel != @In @Out - you should regard it as equivalent to @Out with the extra databinder stuff.

                • 5. Re: @In(required = false,value=
                  lcoetzee

                  Aaah.. the behavior of DataModel has changed a lot (earlier it did provide some pseudo @In/@Out functionality)!

                  Is there a way that I can get the changed stuff from "sections" back into the DataModel and displayed?

                  (Apologies for grabbing so much airtime with this!)


                  L

                  • 6. Re: @In(required = false,value=
                    pmuir

                    You should just be able to @In it.