4 Replies Latest reply on May 16, 2012 2:45 PM by jbrow

    "onModuleLoad()" called twice

    jbrow

      I apologize if this is answered somewhere, but I've looked all around, and I can't find it anywhere.

       

      Injection doesn't work in the main class designated with @EntryPoint until you reach the @PostConstruct phase (at least that's what it appears to me) -- you just get nulls for the injected variables.  I've looked at many examples, and it seems that most people put the @PostConstruct on the "onModuleLoad()" method.  When I do that, the "onModuleLoad()" gets called twice.  At first I thought I might need to remove the

      'com.google.gwt.user.User' module, but I wasn't sure of all the implications of doing that, and it looked like other people who posted their code had the

      'com.google.gwt.user.User' module and the @PostConstruct on the "onModuleLoad()".

       

      What am I doing wrong?

        • 1. Re: "onModuleLoad()" called twice
          cbrock

          What version of Errai are you using?

          • 2. Re: "onModuleLoad()" called twice
            jbrow

            Sorry I left that out.  2.0.0-Final

            • 3. Re: "onModuleLoad()" called twice
              cbrock

              Can you paste your .errai/BootstrapperImpl.java from your project root? One thing you might also want to try is to ensure that it is the same instance of the bean getting called by printing out the object identity (ie. System.out.println(System.identityHashCode(this))) to ensure that there somehow aren't two instances of the bean.

               

              Any code you can share with us will also be helpful.

              • 4. Re: "onModuleLoad()" called twice
                jbrow

                Thanks, Mike!  That was it!

                 

                I was so focused on the inherit statements that I missed the

                 

                <entry-point
                                    class='com.radical.telephony.configuration.client.RCATSConfigurator' />
                
                

                 

                 

                stuck at the bottom of the ".gwt.xml" file.  And I looked at that file a hundred times.

                 

                Sorry about that, and thanks for the help!