5 Replies Latest reply on Aug 23, 2014 12:00 PM by Mark McCurry

    My Errai 2.4.4 to 3.0.1 upgrade experience

    Mark McCurry Newbie

      First of all... greeting Errai team and Errai fans. I'm a huge fan too. I'm a bit new to posting so please forgive me if I don't get it right. I've been working with Errai, on and off, since I first discovered it back in 2011. My investiment in it is now substancial. Although I must admit that I don't know it as well as I would like to. I wish I had the time to dig deep, understand it thoroughly, and contribute back to the project. I hope, one day, to get there.

       

      My current GWT project is using Errai 2.4.4. The other big tool in the toolbox is SmartGWT. I don't use development mode. I make a change, compile a WAR (with Maven), and deploy it to an off-node Tomcat (7.0.35). 90% of what I use Errai for is client side. It is the most superb tool for decoupling screen widgets, dialog boxes, and other client side objects. The remote bus is not used. In fact, "erraiBusRemoteCommunicationEnabled" is set to false. All communication to the server happens through Errai JAX-RS. I make heavy use of the client side (sync) bean manager and CDI, and finally, Errai Navigation. The app.gwt.xml contains this:

       

      [code]

          <inherits name='com.google.gwt.user.User'/>

          <inherits name="com.smartgwt.SmartGwtNoTheme"/>

          <inherits name="com.smartclient.theme.blackops.BlackOps"/>

          <inherits name="org.jboss.errai.bus.ErraiBus"/>

          <inherits name="org.jboss.errai.ioc.Container"/>

          <inherits name="org.jboss.errai.enterprise.Jaxrs"/>

          <inherits name="org.jboss.errai.ui.nav.Navigation"/>

      [/code]

       

      Which brings me to the reason for this post. It was a problem with Errai Navigation where, on page load, it would only show me the top 100 pixels of the "default" page. The code in PostConstruct of the EntryPoint class had worked... just over a year ago when I first tried Errai Navigation...

       

      [code]

          VLayout page = new VLayout(); // A SmartGWT vertical layout construct

              page.setWidth100();

              VxBanner banner = instanceBanner.get();

              page.addMember(banner);

              page.addMember(navigation.getContentPanel().asWidget());

              VxFooter footer = instanceFooter.get();

              page.addMember(footer);

              RootPanel.get().add(page);

      [/code]

       

      Between the banner DIV and my actual "default" page DIV, there were three more DIVs, each a parent of the default page DIV. One, I assume belonged to the VLayout. The other two, I assume were coming from Errai Navigation. One of those was set to a fixed height of 100px, with overflow: hidden. Hence, my problem. If only the overflow had been set to visible!

       

      To help me identify where this DIV is coming from... and possibly fix it as well... I decided to use the technique described in the Errai reference called "11.2.6. Overriding the default Nagivating Panel type". I found this in the 2.4.4 reference... as well as the 2.4.3 and 2.4.2 references. Unfortunately, the actual interface "NavigatingContainer" is not in the 2.4.4 JAR my Maven had fetched.

       

      Digging a little, I discovered it IS in the 3.0.1 JAR. So... ok.... lets upgrade.

       

      I edited my Maven POM, changing the Errai version from "2.4.4" to "3.0.1". mvn clean. mvn package.

       

      Errors. Well... not unexpected. The same error over and over:

      [CODE]

      [INFO]             generating ioc bootstrapping code...

      [ERROR] java.util.concurrent.ExecutionException: org.jboss.errai.ioc.rebind.ioc.exception.UnsatisfiedDependenciesException:  @> com.vmedex.uiapp.client.local.banner.VxBanner

      [ERROR]  - field org.jboss.errai.codegen.meta.MetaField:com.vmedex.uiapp.client.local.banner.VxBanner.dispatcher could not be satisfied for type: org.jboss.errai.bus.client.api.messaging.RequestDispatcher

      [ERROR]   Message: can't resolve bean: org.jboss.errai.bus.client.api.messaging.RequestDispatcher ( @Default )

      [ERROR]

      [ERROR]     at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)

      [ERROR]     at java.util.concurrent.FutureTask.get(FutureTask.java:111)

      [ERROR]     at org.jboss.errai.config.rebind.AsyncGenerators$FutureWrapper.get(AsyncGenerators.java:112)

      [/CODE]

       

      Every instance of:

      [CODE]

          @Inject

          private RequestDispatcher dispatcher;

      [/CODE]

      in my app, was causing this. I'm hoping you can help me understand why. I checked the JAR... its there!

       

      So I went a'Googling for a 3.0.1 example app... which I found at GitHub. In it, MessageBuilder...callNowWith was passing "bus" instead of "dispatcher". So, I removed every instance of the @Inject... dispatcher from my app, and sure enough, successful build of the WAR.

       

      Not so bad. Thought I was done, but... no. I deployed the WAR and opened the app... and none of my bus subscription callbacks were firing. yuk. Referring back to the example from GitHub, I could only find one other difference... Instead of the:

      [CODE]

          @Inject

          private MessageBus bus;

      [/CODE]

       

      I was using throughout in 2.4.4, the example used:

      [CODE]

          private ClientMessageBus bus = (ClientMessageBus) ErraiBus.get();

      [/CODE]

       

      I tested using ErraiBus.get() instead of the @Inject on a couple of classes, and sure enough! The publish/subscribe (bus) between those classes started working again.

       

      Any insight you can offer about why I encountered these two particular issues after upgrading to 3.0.1 would be greatly appreciated. I still haven't tackled the original issue with Navigation yet... but I'm more concerned now with having to make such sweeping changes to the code base to get things working. I'm sure I've just done something wrong. I am happy to provide any other details you need.

       

      My profound thanks for such a great GWT enhancement. Errai rocks!

       

      Mark

        • 1. Re: My Errai 2.4.4 to 3.0.1 upgrade experience
          Max Barkley Expert

          Hi Mark,

           

          Regarding your errors while upgrading, did you have the errai-ioc-bus-support jar on your classpath? It defines the providers for injecting the RequestDispatcher and the MessageBus. Ideally it should be set to provided scope.

           

          Cheers.

          1 of 1 people found this helpful
          • 2. Re: My Errai 2.4.4 to 3.0.1 upgrade experience
            Mark McCurry Newbie

            Max,

            Thanks for taking a look. Interestingly, in the Eclipse project tree, Java Resources -> Libraries -> Maven Depenedencies, errai-ioc-bus-support-3.0.1.Final.jar is listed. However, that's no thanks to me. I don't list it as a direct dependency in my POM. It must be a sub-dependency of something I am listing. I'll try adding it to my POM and see what happens. Thanks!! For the record, here are the errai direct dependencies I have in my POM (note with errai.version set to "2.4.4", these produce a working app with functioning @Injects for MessageBus and RequestDispatcher):

             

                    <!-- Errai Bus CLIENT dependencies -->

                    <dependency>

                        <groupId>org.jboss.errai</groupId>

                        <artifactId>errai-ioc</artifactId>

                        <version>${errai.version}</version>

                        <scope>provided</scope>

                    </dependency>

             

                    <dependency>

                        <groupId>org.jboss.errai</groupId>

                        <artifactId>errai-cdi-client</artifactId>

                        <version>${errai.version}</version>

                        <scope>provided</scope>

                    </dependency>

             

                    <dependency>

                        <groupId>org.jboss.errai</groupId>

                        <artifactId>errai-jaxrs-client</artifactId>

                        <version>${errai.version}</version>

                        <scope>provided</scope>

                    </dependency>

             

                    <dependency>

                        <groupId>org.jboss.errai</groupId>

                        <artifactId>errai-navigation</artifactId>

                        <version>${errai.version}</version>

                        <scope>provided</scope>

                    </dependency>

                   

                    <!-- These four are required to handle Web Service calls in Tomcat -->

                    <!-- and provide full errai bus bi-directional functionality -->

                    <dependency>

                        <groupId>org.jboss.errai</groupId>

                        <artifactId>errai-jaxrs-provider</artifactId>

                        <version>${errai.version}</version>

                    </dependency>

             

                     <dependency>

                         <groupId>org.jboss.resteasy</groupId>

                         <artifactId>resteasy-jaxrs</artifactId>

                         <version>${resteasy.version}</version>

                     </dependency>

             

                     <dependency>

                         <groupId>org.jboss.errai</groupId>

                         <artifactId>errai-bus</artifactId>

                         <version>${errai.version}</version>

                     </dependency>

             

                     <dependency>

                         <groupId>org.jboss.errai</groupId>

                         <artifactId>errai-tools</artifactId>

                         <version>${errai.version}</version>

                     </dependency>

             

            Thanks once again,

            Mark

            • 3. Re: My Errai 2.4.4 to 3.0.1 upgrade experience
              Mark McCurry Newbie

              Hi Max,

               

              Just some followup, as I had promised to try it... I added the following direct dependency to my POM:

                  <dependency>
                 <groupId>org.jboss.errai</groupId>
                 <artifactId>errai-ioc-bus-support</artifactId>
                 <version>${errai.version}</version>
                 <scope>provided</scope>
                 </dependency>
                

              It did not change the result. I still get a compile (code gen) error with any attempt to declare:

              @Inject private RequestDispatcher dispatcher;

              and I still get a non-functioning local bus at runtime when I declare:

              @Inject private MessageBus bus;

              but a functioning local bus if I declare instead:

              private MessageBus bus = (MessageBus) ErraiBus.get();

               

              Thanks,

              Mark

              • 4. Re: My Errai 2.4.4 to 3.0.1 upgrade experience
                Max Barkley Expert

                Hey Mark,

                 

                Looking back at the inherited GWT modules you posted, you will probably also need to inherit the BusSupport module as well (org.jboss.errai.ioc.support.bus.BusSupport).

                 

                Cheers.

                • 5. Re: My Errai 2.4.4 to 3.0.1 upgrade experience
                  Mark McCurry Newbie

                  Hi Max!

                  First an apology. I was pulled away to get a release out in the old code base. So I've been on a two week trip down memory lane. We finally punched it through QA on Friday... figuratively, of course... they told me I was not allowed to actually punch the QA people... I was, at times, tempted though. ;o) I'm finally back working with Errai.

                  Your last post was spot on. Genius. I did a little digging in the Maven repo and it turns out errai-ioc-bus-support is pulled in as a sub-dependency of errai-ioc-client, so no need for me to add it as an explicit dependency in my POM. However... adding:

                     <inherits name="org.jboss.errai.ioc.support.bus.BusSupport"/>

                  to the GWT descriptor was essential. This was apparently not necessary in Errai 2.4.4, but is in Errai 3.0.1.

                  With it added, the compile time problem with @Inject private RequestDispatcher dispatcher; goes away. I was able to change my "sendNowWith" calls back to "dispatcher", and at runtime, the local bus is firing away. The @Inject private MessageBus bus; is happy now as well.

                  I am grateful for your help with this. Hopefully others doing the same Errai upgrade will be as well. I'm now off to try to solve the Errai Navigation issue that started all this. I think it is from some unwanted interaction between the Errai navigation panel and SmartGWT. My Errai navigation "pages" are of differing heights, so when I go to a "taller" page, it gets clipped at the height of the previous navigation page. Anyway, I'll save that for another post.

                   

                  Once again, thank you for your insight on resolving the 2.4.4 to 3.0.1 upgrade issue,

                  Mark