4 Replies Latest reply on Sep 28, 2013 5:20 AM by Malte Pickhan

    Getting started with Errai and Gradle

    Malte Pickhan Newbie

      Hello there,

       

      I currently try to get Errai running with Gradle, and I have a quite hard time.

       

      I am using the following dependencies:

      • org.jboss.errai:errai-javaee-all:2.4.0.Final
      • com.google.gwt:gwt-dev:2.4.0 (For Compiling)

       

      At first, all dem Applications I find, are either not compileable, or not able to resolve dependencies and so on...

      Therefore I thought, ok lets get it done and start on your own....

       

      I'm getting the Application Compiled and started by the Eclipse GWT Developer Plugin.

      My Project has the following structure:

       

      src/main/java/myProject/

           |client/local/

           +     Application.java

           +     application.gwt.xml

           |server

           +     ServerApp.java

      src/main/webapp/

      +     index.html

           |WEB-INF

           +     web.xml

       

      They have the following Content:

       

      Application.java

      @EntryPoint
      public class Application extends VerticalPanel {
          @Inject
          RegisterWidget widget; //Currently not used to make the usecase more simple
         
          Label lbl;
         
          @PostConstruct
          public void onModuleLoad() {
              lbl = new Label("What up?");
              add(lbl);
          }
      }
      
      

       

      ServerApp.java

      @ApplicationScoped
      public class ServerApp {
      
          public ServerApp(){
              System.out.println("############### GODSAKE I RUN!!!!!!!!!!");
          }
      }
      
      
      

       

      application.gwt.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
              "http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
      
      <module rename-to="application">
           <inherits name="org.jboss.errai.enterprise.All" />
      </module>
      
      
      
      

       

      web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">
      
      <web-app>
      <servlet>
        <servlet-name>jUnitHostImpl</servlet-name>
        <servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>jUnitHostImpl</servlet-name>
        <url-pattern>/application/junithost/*</url-pattern>
      </servlet-mapping>
        <!-- Default page to serve -->
        <welcome-file-list>
          <welcome-file>index.html</welcome-file>
        </welcome-file-list>
      </web-app>
      
      

       

       

      When I try to access the Application the Page stays with a white Background and the Console is getting Spammed with

       

      [WARN] 404 - POST /out.80377-44424.erraiBus?z=2&clientId=80377-44424&wait=1&phase=connection (127.0.0.1) 1410 bytes
         Request headers
            Host: 127.0.0.1:8888
            Connection: keep-alive
            Accept: */*
            User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1638.0 Safari/537.36
            Accept-Encoding: gzip,deflate,sdch
            Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
            Referer: http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997
            Content-Length: 159
            Origin: http://127.0.0.1:8888
            Content-Type: application/json; charset=UTF-8
         Response headers
            Content-Type: text/html; charset=iso-8859-1
            Content-Length: 1410
      
      

       

      So, what am I missing here? Hope somebody can help me!

       

      Cheers,

      Malte

        • 1. Re: Getting started with Errai
          Christian Sadilek Master

          Hi Malte,

           

          Currently the easiest way to get started is to download the errai-tutorial project (checkout the README file):

          https://github.com/errai/errai-tutorial/archive/master.zip


          Unfortunately, we don't have a setup using Gradle. From the console log it looks like the server-side bus didn't deploy correctly (/out. returning a 404). Can you check if the errai-bus.jar has been deployed?


          Cheers,

          Christian

          1 of 1 people found this helpful
          • 2. Re: Getting started with Errai
            Malte Pickhan Newbie

            Hi Christian,

             

            Thanks for answering. If I interpret your answer right, I need an Java Application server running to get an example running properly? My assumption was that, the GWT Plugin of Eclipse would take care of that?

             

            Is there the possibility to do a proper setup with the GWT Plugin only?

             

            If I get the Project running with Gradle, I will provide some documentation and an Excample Project.

             

            Cheers,

             

            Malte

            • 3. Re: Re: Getting started with Errai
              Malte Pickhan Newbie

              I got the App running now with some support form IRC.

               

              At first, there was still an Issue with my Gradle script which I had to fix to create a valid WAR file.

              Than I had to setup an EAS where I could deploy the WAR. Than you can also use the "run on external server" command of the Eclipse GWT plugin.

               

              Furthermore I upgraded to version 2.4.0.Final of Errai. Just to let you know following Exception is known by the Errai Team but doesn't harm your code:

               

              21:01:25,531 ERROR [org.jboss.errai.reflections.Reflections] (Thread-68) could not create Vfs.Dir from url. ignoring the exception and continuing: org.jboss.errai.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [vfs:/C:/Program Files (x86)/jboss-eap-6.1/bin/content/tts-ui-1.0.war/WEB-INF/lib/errai-marshalling-2.4.0.Final.jar/]

               

              Available types: [jarfile, jarUrl, directory, vfsfile, vfszip, org.jboss.errai.common.metadata.WarUrlType@1e8608b4, *.jnilib, *.zip, *.pom]

              Do you need to add app server specific support to your deployment? (For example, errai-jboss-as-support for AS7)

                      at org.jboss.errai.reflections.vfs.Vfs.fromURL(Vfs.java:126) [reflections-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.reflections.vfs.Vfs.fromURL(Vfs.java:108) [reflections-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.reflections.Reflections.scan(Reflections.java:228) [reflections-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.common.metadata.MetaDataScanner.<init>(MetaDataScanner.java:105) [errai-common-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.common.metadata.MetaDataScanner.createInstance(MetaDataScanner.java:202) [errai-common-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.common.metadata.MetaDataScanner.createInstance(MetaDataScanner.java:190) [errai-common-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.common.metadata.ScannerSingleton$1.call(ScannerSingleton.java:39) [errai-common-2.4.0.Final.jar:2.4.0.Final]

                      at org.jboss.errai.common.metadata.ScannerSingleton$1.call(ScannerSingleton.java:31) [errai-common-2.4.0.Final.jar:2.4.0.Final]

                      at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_40]

                      at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]

               

              And the important hint I got from IRC was, I have to use the "data-field" tag in the HTML file!

               

              Thanks especially to mbarkley!

               

              I will share a blog post regarding the Gradle build and will let you know about.

               

              Cheers,

               

              Malte

              1 of 1 people found this helpful
              • 4. Re: Getting started with Errai and Gradle
                Malte Pickhan Newbie

                Hello,

                 

                as promised, you can find a small HowTo about that here:

                 

                http://mpickhan.de/2013/09/28/run-erraigwt-with-gradle/

                 

                I hope it will be usefull for someone.

                 

                Cheers,

                 

                Malte