13 Replies Latest reply on Jul 15, 2013 4:59 PM by magick93

    Error when trying to upgrade to 2.3.0

    magick93

      Hello, I am trying to upgrade our Errai project from 2.2.0 to 2.3.0.Final, and we are running into an error - This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement() - however no offending class or file is given.

       

      How can we correct this?

        • 1. Re: Error when trying to upgrade to 2.3.0
          jfuerth

          Hi Anton,

           

          We've seen this before. There was actually a bug in Errai 2.3.0.Final which led to this happening under certain circumstances when starting an Errai app on a page other than its starting page. I strongly recommend you upgrade all the way to 2.3.2.Final to get the latest fixes on that branch.

           

          The low-level cause of this error is an attempt to add a GWT Composite widget to the DOM before it has been told which widget it represents. In Errai, this usually means some attempt to add an Errai UI templated widget (or a @Templated @Page) to the DOM inside its constructor, before the templating logic has had a chance to create the element and bind it to the composite.

           

          If updating to 2.3.2.Final doesn't fix this for you, the problem could be in your own app, or it could be a previously undiscovered bug in the Errai framework. In this case, we'll work with you to reproduce this issue on our end so we can find a fix (and test case) for it.

           

          -Jonathan

          • 2. Re: Error when trying to upgrade to 2.3.0
            magick93

            Thanks Jonathan

             

            Unfortunately even with 2.3.2.Final we are still getting the error.

             

            We make extensive use of @PostConstruct - could this be the problem?

            • 3. Re: Error when trying to upgrade to 2.3.0
              jfuerth

              By my understanding, your @Templated Composite widgets should be fully initialized before their @PostConstruct is invoked.

               

              Have you checked in all three possible places for a stack trace:

              • the IDE or command line console (wherever you launched dev mode from)
              • the GWT dev mode UI tab corresponding with your browser session
              • the browser's own console

               

              A stack trace (obviously) could help narrow this down a lot.

               

              If you can't find one, we'll have to use a debugger to set a breakpoint where that error message is printed (within GWT) and have you launch your app in dev mode with a debugger attached.

               

              -Jonathan

              • 4. Re: Error when trying to upgrade to 2.3.0
                magick93

                Yes, the stack trace is the same on all.

                 

                                00:00:00.000 [ERROR] Unable to load module entry point class org.jboss.errai.ioc.client.Container (see associated exception for details) 

                java.lang.RuntimeException: critical error in IOC container bootstrap
                     at org.jboss.errai.ioc.client.Container.bootstrapContainer(Container.java:69)
                     at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:34)
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                     at java.lang.reflect.Method.invoke(Method.java:601)
                     at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
                     at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
                     at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
                     at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
                     at java.lang.Thread.run(Thread.java:722)
                Caused by: java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()
                     at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java:527)
                     at org.jboss.errai.ui.shared.TemplateUtil.compositeComponentReplace(TemplateUtil.java:61)
                     at org.jboss.errai.ioc.client.BootstrapperImpl$66$1.init(BootstrapperImpl.java:1635)
                     at org.jboss.errai.ioc.client.BootstrapperImpl$66$1.init(BootstrapperImpl.java:1)
                     at org.jboss.errai.ioc.client.container.CreationalContext.resolveAllProxies(CreationalContext.java:351)
                     at org.jboss.errai.ioc.client.container.CreationalContext.finish(CreationalContext.java:312)
                     at org.jboss.errai.ioc.client.Container.bootstrapContainer(Container.java:59)
                     at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:34)
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                     at java.lang.reflect.Method.invoke(Method.java:601)
                     at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
                     at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
                     at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
                     at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
                     at java.lang.Thread.run(Thread.java:722)
                • 5. Re: Error when trying to upgrade to 2.3.0
                  jfuerth

                  This looks like it could indeed be due to a bug in the framework, perhaps related to the handling of dependency injection cycles.

                   

                  Can you post the beangraph.gv file and the BootstrapperImpl.java file from your .errai directory? Given those, I should be able to reproduce the error if it is indeed a framework issue.

                   

                  -Jonathan

                  • 6. Re: Error when trying to upgrade to 2.3.0
                    magick93

                    Thanks Jonathan

                     

                    The files are attached. Hope it helps.

                    • 7. Re: Error when trying to upgrade to 2.3.0
                      jfuerth

                      Hi Anton,

                       

                      These files appear to be from a different execution of your app than the one that produced the stacktrace above. Can you please reproduce the issue again and include beangraph.gv, BootstrapperImpl.java, and the stack trace of the failure all from the same run?

                      • 8. Re: Error when trying to upgrade to 2.3.0
                        magick93

                        Sorry for the delay.

                         

                        Here is the stack trace, beangraph and bootstrapperImpl:

                         

                        [INFO] INFO [JaxrsProxyLoaderGenerator] generating jax-rs proxy loader class.

                        [ERROR] java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()

                        [ERROR]         at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java:527)

                        [ERROR]         at org.jboss.errai.ui.shared.TemplateUtil.compositeComponentReplace(TemplateUtil.java:61)

                        [ERROR]         at org.jboss.errai.ioc.client.BootstrapperImpl$68$1.init(BootstrapperImpl.java:1711)

                        [ERROR]         at org.jboss.errai.ioc.client.BootstrapperImpl$68$1.init(BootstrapperImpl.java:1)

                        [ERROR]         at org.jboss.errai.ioc.client.container.CreationalContext.resolveAllProxies(CreationalContext.java:351)

                        [ERROR]         at org.jboss.errai.ioc.client.container.CreationalContext.finish(CreationalContext.java:312)

                        [ERROR]         at org.jboss.errai.ioc.client.Container.bootstrapContainer(Container.java:59)

                        [ERROR]         at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:34)

                        [ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        [ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                        [ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                        [ERROR]         at java.lang.reflect.Method.invoke(Method.java:601)

                        [ERROR]         at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)

                        [ERROR]         at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)

                        [ERROR]         at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)

                        [ERROR]         at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)

                        [ERROR]         at java.lang.Thread.run(Thread.java:722)

                        • 9. Re: Error when trying to upgrade to 2.3.0
                          magick93

                          I know you guys are busy making Errai even more amazing.

                           

                          I just wanted to gently bump this, as we are really wanting to take advantage of some of the recently added goodness.

                           

                          Do you have any idea what the problem might be? And what we can do so we can upgrade?

                          • 10. Re: Error when trying to upgrade to 2.3.0
                            jfuerth

                            Hi Anton,

                             

                            Thanks for your patience and understanding while we work through this.

                             

                            I did dig into your new attachment on Friday, and everything lines up properly. Thanks for re-doing it.

                             

                            Unfortunately, I don't have anything new that might help you yet. It does appear to be a bug in the framework which is caused by a proxy object that ErraiIOC inserted to break an injection cycle. My plan is to try and reproduce this issue in our test suite so we can work toward a fix, but I haven't had the time to do this yet. Hopefully soon.

                             

                            The workaround (not satisfactory, I admit... maybe even impossible) would be to try and identify the bean injection cycles involving the NavigationController.navbar field, and break them yourself.

                             

                            The correct fix will be to make Errai's IOC proxies play well with templated components.

                             

                            Cheers,

                            Jonathan

                            • 11. Re: Error when trying to upgrade to 2.3.0
                              xybrek

                              Hi Jonathan,

                               

                              I'm trying to understand the logic of this issue, however, if you say there is a potential bug, why are other projects made with 2.3.0 work? So there must be something that is "lurking" in the existing code that is made with the lower version like 2.2.0 where this version may have just "ignored" this thing that breaks in 2.3.0

                               

                              And also, do you mean its possible to get something by putting breakpoint on the NavigationController class of the application, and step step through with it?

                               

                              -Xybrek

                              • 12. Re: Error when trying to upgrade to 2.3.0
                                jfuerth

                                Hi Xybrek,

                                 

                                There have been a lot of changes to the underpinnings of ErraiIOC and ErraiCDI since 2.2.0.

                                 

                                Injection cycles in ErraiIOC are broken by introducing a proxied bean somewhere in the cycle. The proxy is just an empty shell that gets injected in an uninitialized state in order to complete the cycle (so the chain of references is created as far as possible), then the "real" bean is created with references the tie the chain back into a loop, and this "real" bean is placed into the empty shell. It seems the bug is that when an ErraiUI templated bean is chosen to be a proxy by the cycle breaking mechanism, the GWT Composite isn't initialized soon enough.

                                 

                                The difference between 2.2.0 and 2.3.2 could be as simple as choosing a different point for the proxy bean in the reference cycle. But that's just speculation; we really need to be able to reproduce the issue in order to understand it fully (and fix it, and create a regression test for this case!)

                                 

                                -Jonathan

                                • 13. Re: Error when trying to upgrade to 2.3.0
                                  magick93

                                  Hi Johnathan

                                   

                                  Our Head of Frontend Dev managed to fix this issue.

                                   

                                  I have no idea how he did it. I will ask him to update this thread in case anyone else is having similar problems.