12 Replies Latest reply on Mar 9, 2006 12:58 PM by gnulp

    initial values

    gnulp

      maybe the question is stupid, but how can I predefine a beans value to show it the first time a page is called as a default-value

      I tried the folowing but without success:

      @Name("myBean")
      @Scope(ScopeType.CONVERSATION)
      public class MyBean {
      
       private String theValueThatShouldBeSeenInTheForm;
      
       public void setTheValueThatShouldBeSeenInTheForm(String str) {
       theValueThatShouldBeSeenInTheForm = str;
       }
      
       public String getTheValueThatShouldBeSeenInTheForm() {
       return theValueThatShouldBeSeenInTheForm;
       }
      }
      


      @Stateful
      @Name("myController")
      @Interceptors(SeamInterceptor.class)
      @LoggedIn
      public class Controller {
      
       @In(value="myBean",create=true)
       protected MyBean myBean;
      
       /**
       * begin conversation
       **/
       @Create
       @Begin
       public void init() {
       myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
       }
      
       /**
       * just do any conversation-logic
       **/
       public void doAnythingAction() {
       ...
       }
      
       /**
       * finish conversation
       **/
       @End
       public void doEndConversationAction() {
       ...
       }
      }


      I was expecting that when the page is called, the form will show up with "Hello World" predefined. But it is empty. After calling doAnythingAction() the value in the form is filled as expected with "Hello World" but a cycle too late ...

      Is my approach wrong ? How can it be solved ?

      thx for your help ...

        • 1. Re: initial values
          gavin.king

          You usually use a @Factory method for this kind of stuff, I guess.

          • 2. Re: initial values
            gnulp

            tried to do it but that doesn't work. I thought the @Factory specifies that the method of the component is used to initialize the value of the named context variable, when the context variable has no value --> which means myBean == null (please correct me if I am wrong). But myBean is already created with the @In(create=true) statement !

            I added as adviced the @Factory-annotation:

            @Stateful
            @Name("myController")
            @Interceptors(SeamInterceptor.class)
            @LoggedIn
            public class Controller {
            
             @In(value="myBean",create=true)
             protected MyBean myBean;
            
             /**
             * begin conversation
             **/
             @Create
             @Begin
             public void init() {
             myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
             }
            
             @Factory("myBean")
             public void initMyBean() {
             // doNothing !!!
             }
            
             /**
             * just do any conversation-logic
             **/
             public void doAnythingAction() {
             ...
             }
            
             /**
             * finish conversation
             **/
             @End
             public void doEndConversationAction() {
             ...
             }
            }
            


            and ended in the following recursive exception - any ideas ???

            2006-03-08 18:37:12,484 ERROR [STDERR] java.lang.reflect.UndeclaredThrowableException
            2006-03-08 18:37:12,500 ERROR [STDERR] at $Proxy155.LoginActionInit(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:1146)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:1134)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:1123)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1071)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1104)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1068)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstanceToInject(Component.java:1178)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.injectFields(Component.java:862)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.inject(Component.java:679)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:29)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:61)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:120)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:62)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:196)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:190)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
            2006-03-08 18:37:12,500 ERROR [STDERR] at $Proxy155.LoginActionInit(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:1146)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:1134)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:1123)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1071)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1104)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1068)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.getInstanceToInject(Component.java:1178)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.injectFields(Component.java:862)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.Component.inject(Component.java:679)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:29)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,500 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:61)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
            2006-03-08 18:37:12,500 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,500 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:120)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:62)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:196)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:190)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
            2006-03-08 18:37:12,515 ERROR [STDERR] at $Proxy155.LoginActionInit(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:1146)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:1134)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:1123)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1071)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1104)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1068)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.getInstanceToInject(Component.java:1178)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.injectFields(Component.java:862)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.Component.inject(Component.java:679)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:29)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,515 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:61)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
            2006-03-08 18:37:12,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,515 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,562 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:120)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:62)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:196)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:190)
            2006-03-08 18:37:12,656 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
            2006-03-08 18:37:12,656 ERROR [STDERR] at $Proxy155.LoginActionInit(Unknown Source)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
            2006-03-08 18:37:12,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:1146)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:1134)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:1123)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1071)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1104)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1068)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1054)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.getInstanceToInject(Component.java:1178)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.injectFields(Component.java:862)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.Component.inject(Component.java:679)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:29)
            2006-03-08 18:37:12,671 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
            2006-03-08 18:37:12,671 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,671 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:61)
            2006-03-08 18:37:12,671 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
            2006-03-08 18:37:12,671 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            2006-03-08 18:37:12,671 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
            2006-03-08 18:37:12,671 ERROR [STDERR] at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
            2006-03-08 18:37:12,671 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
            
            this continous endless
            
            



            So what is the difference between @Factory and @Create, and when in the livecycle of Seam a injected bean is available ???
            It is a fact, that the bean is already created when the init()-Method is called (otherwise I would get a nullpointerexception), but the changed value there is not outjected to the faces-context again after init() has finished (that is what I assume). Even the @Out annotation has no influence on this at all ...

            Is this a bug or a feature ? Please help ...



            • 3. Re: initial values

              I suggest you remove the @In annotation.

              • 4. Re: initial values
                gnulp

                No - that won't work !

                (1) I need the injection of myBean, because it holds the values of the form. If I remove the @In-annotation I have no access to the beanValues filled from the jsf-form within my controller !

                (2) Assume you have a @Valid annotation for your bean for childvalidation. If you remove the @In statement it will throw a nullpointerexception, because its now impossible for seam to identify which child to use for validation (it needs @Name-annotation-reference to identify which child to validate)

                any further ideas ?

                • 5. Re: initial values

                  Try populating your @Factory method, or adding a @Create method to your myBean. There are example in the Seam distro that show working @Factory used to populate initial values.

                  -Jim

                  • 6. Re: initial values
                    gnulp

                    sorry again, but still the problem is not solved !

                    (1) In seam-examples the @Factory method is always used with @DataModel - that works perfect - but there is no example where you want to set values of a injected bean !

                    (2) Adding a @Create in the bean is possible, but it changes the applications behavior ! If I want to reuse the same bean in several controllers, everywhere the values would be initialized - that is not intended ...

                    At the moment I stuck because of leck of understanding SeamObject-Constructor. Please correct me if I am wrong:

                    There are two different kinds of "constructors" - @Factory and @Create. It seams, that @Factory is pushing the changes immediatelly out for usage in jsf but does not work with injected variables, and @Create won't push the changed variables to be used in jsf.

                    I start asking myself, whether it is really needed to have two different kind of "constructors". Wouldn't it be much easier to have just @Create and do all initializations there at once - instead of calling several @Factory-Methods for each variable that needs to be initialized ? Currently if you have n-DataModel definitions you need to write n-@Factory-Methods for initialization. I would prefer to use the @Create-Method (like in any object oriented language) and have all initializations done there.

                    any thoughts about that are welcome ...

                    thx

                    • 7. Re: initial values
                      gavin.king

                       

                      @Name("foo")
                      public class Foo
                      {
                      
                       @In(create=true) Bar bar;
                      
                       public String action()
                       {
                       ...
                       }
                      
                      }


                      @Name("barFactory")
                      public class BarFactory
                      {
                      
                       @Out Bar bar;
                      
                       @Factory("bar")
                       public void initBar()
                       {
                       bar = new Bar();
                       }
                      }





                      • 8. Re: initial values
                        gavin.king

                        @Create and @Factory are totally different things.

                        Are you sure you have understood what @In(create=true) does?

                        • 9. Re: initial values
                          gavin.king

                          Perhaps this also works for you:

                          @Name("foo")
                          public class Foo
                          {
                          
                           @In(create=true) Bar bar;
                          
                           public String action()
                           {
                           ...
                           }
                          
                          }


                          @Name("bar")
                          public class Bar{
                          
                           private String string;
                          
                           @Create
                           public void initBar()
                           {
                           string = "initial value";
                           }
                          }
                          


                          @Factory is usually used for creating things that are not Seam components. When you are creating a Seam component, you don't usually need it. Seam automatically creates the component if you have @In(create=true).

                          • 10. Re: initial values
                            gavin.king

                            OK, just looked again at your original code.

                            I think what you are trying to do is something like this:

                            @Name("myBean")
                            @Scope(ScopeType.CONVERSATION)
                            public class MyBean {
                            
                             private String theValueThatShouldBeSeenInTheForm;
                            
                             public void setTheValueThatShouldBeSeenInTheForm(String str) {
                             theValueThatShouldBeSeenInTheForm = str;
                             }
                            
                             public String getTheValueThatShouldBeSeenInTheForm() {
                             return theValueThatShouldBeSeenInTheForm;
                             }
                            }


                            @Stateful
                            @Name("myController")
                            public class Controller {
                            
                             @In(value="myBean", required=false)
                             protected MyBean myBean;
                            
                             /**
                             * begin conversation
                             **/
                             @Begin
                             @Factory("myBean")
                             public void init() {
                             myBean = Component.newInstance("myBean");
                             myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
                             }
                            
                             /**
                             * just do any conversation-logic
                             **/
                             public void doAnythingAction() {
                             ...
                             }
                            
                             /**
                             * finish conversation
                             **/
                             @End
                             public void doEndConversationAction() {
                             ...
                             }
                            }


                            But do you see how this simply doesn't make any sense?

                            If you *always* want to run this initialization every time a page references myBean, then you can just do the initialization in an @Create @Begin method of myBean. You don't need to do it in the controller at all.

                            If, on the other hand, this is controller-specific initialization, just do it in an @Create @Begin method of the controller and make sure your page references myController somewhere, to force creation of the controller. This way, it will have nothing at all to do with @Create or @Factory methods for myBean.



                            • 11. Re: initial values
                              gnulp

                              oh yes - thank you I was already in doubt about my english ;-)

                              what you say is exactly what I tried to express and I have already tested this approach in the very beginning - but this is not working !

                               ...
                              
                               @In(value="myBean", required=false)
                               protected MyBean myBean;
                              
                               /**
                               * begin conversation
                               **/
                               @Begin
                               @Factory("myBean")
                               public void init() {
                               myBean = Component.newInstance("myBean");
                               myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
                               }
                               ....
                              


                              ends in a recursive endless exception ! So you are also of the opinion that this should work ? Then this seams to be a bug ---> see my second entry at 13:07 there is a long exception !!!

                              Please confirm I was already in doubt if I really undestand what's happening ... I will try to check my code to investigate under what circumstances this error happens ...

                              thx




                              • 12. Re: initial values
                                gnulp

                                ok - here is some results from testing ...

                                case 1


                                @In(required=false)
                                +
                                @Factory


                                throws no exception, but initial value is not set !

                                case 2

                                @In(required=false) @Out
                                +
                                @Factory


                                throws an exception, telling me the out-value must be set ! (It's what I expected due to case (1)

                                case 3

                                @In(create=true)
                                +
                                @Factoty
                                }


                                throws this recursive exception ...

                                And finally I found a combination that works for my case :o)
                                case 4

                                @In(required=false) @Out
                                +
                                @Factoty
                                public void initBean() {
                                myBean = (MyBean)Component.getInstance("counter",true);
                                }
                                +
                                @Create
                                public void init() {
                                myBean = (MyBean)Component.newInstance("counter");
                                myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
                                }


                                I think this is not very intuitive - but once you know what you do - its easy ...

                                thx for your help ...