4 Replies Latest reply on Jul 11, 2010 7:31 PM by Tim Evers

    In attribute requires non-null value:

    Jubril Adisa Novice

      I defined a component




      @Name("storage")
      @Scope(ScopeType.SESSION)
      @Install
      public class Storage {
              
              public Storage(){
                      
              }
              public void Shout() {
                      System.out.println("I am Shouting");
              }
      
      }




      and any time i try to inject it


      @In Storage storage;




      I get this exceptions




      0:07:04,961 ERROR [SeamLoginModule] Error invoking login method
      javax.el.ELException: org.jboss.seam.RequiredException: @In attribute requires non-null value: authenticator.storage
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
              at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
              at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
              at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
              at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
              at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:109)
              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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
      
      


        • 1. Re: In attribute requires non-null value:
          Ingo Jobling Master

          Add @AutoCreate to the component, or use @In with "create=true"

          • 2. Re: In attribute requires non-null value:
            Tim Evers Master

            Or alternatively add
            @Startup to your Storage class. This will instantiate an instance of this component when the session is started.


            Plenty of ways to do this.

            • 3. Re: In attribute requires non-null value:
              Allan De Leon Newbie
              @In(create=true) isn't creating an instance of my component for some reason. I have:

              @Entity
              @Name("account")
              public class Account {
              ......
              }


              and


              @Stateful
              @Scope(CONVERSATION)
              @Name("accountService")
              public class AccountServiceBean implements AccountService {

                   @Logger
                   Log log;

                   @In(create = true) // This isn't creating a new instance if account is null
                   @Out(required = true)
                   private Account account;


                   @Create
                   public void init() {
                          // My not-so-ideal workaround...
                          if (account == null) {
                              log.info("Account instance was null here! Should NOT have been null!");
                              account = new Account();
                           }
                      }

              .......
              }

              I get the following if I don't use the @Create method above to init the account component:
              javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: accountService.account
                      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                      at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                      at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
              .
              .
              .
              .

              I never had this issue in my previous seam project. For some reason, @In(create=true) doesn't seem to work anymore. I've scoured the net looking for anything related to this issue. This post is best I could find. Hoping others in the forum might have seen this issue and offer some advice...

              Using seam 2.2.0.GA

              thanks
              • 4. Re: In attribute requires non-null value:
                Tim Evers Master

                Try


                @In(create=true, required=true)
                @Out(required=true)
                private Account account;
                



                I have a funny feeling you need the required=true to make it work the way you want.