2 Replies Latest reply on Aug 21, 2009 6:53 PM by Brandon Simpson

    Pronlem with @Starup component

    Y E Newbie


      I have a problem with two of my seam components and I hope someone could point me at what might be wrong.

      Here's what I've got:

      public class Generatror implements Serializable
          @In Helper helper;    
          public void useHelper()
            // call to helper.getMyMap()

      public class Helper
        private Map<String, myEntity> myMap=new HashMap<String, myEntity>();
           public void load()
           public void getMyMap()
              return this.MyMap;

      The problem I have is that although I can see (when debugging) that the load method is being executed during startup and that myMap is populated with the values I expect,
      when it gets to the point of using that map in letterGenerator.useHelper() method myMap object is empty, as if another instance of this class was created, but the load method was not executed.

      I am, though, able to use myMap in my xhtml pages.

      Could anyone tell me what's wrong with my components?


        • 1. Re: Pronlem with @Starup component
          Arbi Sookazian Master

          I have not used the depends attribute in the @Startup annotation, but I would add debug brkpts to see what's going on.  Especially in the @Create method (although I would assume that that method is only called once b/c the component is Session scoped).

          • 2. Re: Pronlem with @Starup component
            Brandon Simpson Newbie

            In your code above, getMyMap() has a return type of void and also this.MyMap is used instead of this.myMap. I'm assuming you just typed those in wrong here in the post, but if not, that could be the problem. hehe

            Try putting some debug statements in your methods load(), getMyMap(), and useHelper(). Sometimes, doing that can offer a clue as to what is going wrong, like seeing calls in the wrong order, etc.