8 Replies Latest reply on Jan 21, 2014 10:15 AM by Max Barkley

    Need Help in setting up Errai Project in Eclipse

    Amit Kumar Newbie

      Hello,

       

      I was fascinated and following this project for quite long. Finally, I got an opportunity to use this powerful project but unfortunately the simplistic expression i got by watching videos is breaking down and i am struggling to even get hello world working and would really appreciate any kind of help.

       

      My Plan - Use Step by Step process to understand and get control on different feature of framework. So

       

      1. I created a simple Project using below maven command  (From your step by step guide) and got the project working from maven command line.

           mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.3.2.Final

      2. But that's not how we do serious development so I imported the project into eclipse and again it worked out of the box. 


      3. Now I tried to add "html templating" functionality and that's where the problem started.

           3.1 First I had to clean POM and added "errai-javaee-all"

           3.2 And then I added a HomePage.html and HomePage.java (empty class with annotation only to just get HTML screen) and that's where i started running into weird problems; below is the error i am struggling right now and would appreciate for any clues?


      Also, Do you have a tutorial that can guide us to add features in a step by step process like

      1. Get project into Eclipse

      2. Add HTMl templating

      3. Add CDI

      4. Add Event handling

      etc .. I mean a practical guide..


      Kind Regards

      Amit


      Loading modules

         com.bc.app.tunedrive.App

            Validating <servlet> tags for module 'app'

               [WARN] Module declares a servlet class 'com.google.gwt.junit.server.JUnitHostImpl', but the web.xml has no corresponding declaration; please add the following lines to your web.xml:

      <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>/app/junithost/*</url-pattern>

      </servlet-mapping>

      INFO [Version] WELD-000900 1.1.6 (Final)

      INFO [Bootstrap] WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

      INFO [CDIExtensionPoints] starting errai cdi ...

      [WARN] Server class 'com.google.gwt.dev.HostedMode' could not be found in the web app, but was found on the system classpath

         [WARN] Adding classpath entry 'file:/home/amit/.m2/repository/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar' to the web app classpath for this session

      INFO [GwtDevHostedModeContainer] Jetty detected, JSR-299 injection will be available in Servlets and Filters. Injection into Listeners is not supported.

      [WARN] Server class 'com.google.gwt.user.client.ui.Composite' could not be found in the web app, but was found on the system classpath

         [WARN] Adding classpath entry 'file:/home/amit/.m2/repository/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar' to the web app classpath for this session

      WARN [InterceptionTypeRegistry] Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled

      WARN [InterceptionTypeRegistry] Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled

      INFO [Reflections] Reflections took 1526 ms to scan 22 urls, producing 538 keys and 2481 values [using 2 cores]

      Starting Jetty on port 8888

         [WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@1767cb4{/,/home/amit/jboss-workspace/tunedrive/src/main/webapp}

      org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:

      Exception 0 :

      javax.enterprise.event.ObserverException

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

        at java.lang.Class.newInstance(Class.java:374)

        at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:344)

        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)

        at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:341)

        at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33)

        at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73)

        at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162)

        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

        at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

        at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:75)

        at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:46)

        at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:40)

        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:359)

        at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:182)

        at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)

        at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)

        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)

        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)

        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)

        at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

        at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

        at org.mortbay.jetty.Server.doStart(Server.java:224)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)

        at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)

        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)

        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)

        at com.google.gwt.dev.DevMode.main(DevMode.java:311)

      Caused by: java.lang.IncompatibleClassChangeError: Class org.jboss.errai.bus.server.service.MessageBusProxy does not implement the requested interface org.jboss.errai.bus.client.api.messaging.MessageBus

        at org.jboss.errai.cdi.server.CDIExtensionPoints.afterBeanDiscovery(CDIExtensionPoints.java:336)

        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:606)

        at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)

        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

        at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)

        at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

        at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

        at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

        ... 26 more

       

       

        at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:48)

        at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:40)

        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:359)

        at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:182)

        at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)

        at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)

        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)

        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)

        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)

        at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

        at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

        at org.mortbay.jetty.Server.doStart(Server.java:224)

        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

        at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)

        at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)

        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)

        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)

        at com.google.gwt.dev.DevMode.main(DevMode.java:311)




        • 1. Re: Need Help in setting up Errai Project in Eclipse
          Amit Kumar Newbie

          ****************** Updates **************************

           

          I recreated the project and got away from above error. Steps that i followed -

          1. I created maven project via webCreater and imported into eclipse.

          2. I have added errai-jee dependency and made changes to belove files as below:

           

          ** My GWT module  **

          <?xml version="1.0" encoding="UTF-8"?>

          <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"

            "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">

          <module rename-to='tunedrive'>

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

          </module>

           

          ** My Entry point **

          import javax.annotation.PostConstruct;

          import org.jboss.errai.ioc.client.api.EntryPoint;

          import com.google.gwt.core.shared.GWT;

          @EntryPoint

          public class TuneDrive {

             @PostConstruct

            public void init() {

             GWT.log("It's working..");

            }

          }

           

          ** Home Page **

          import org.jboss.errai.ui.nav.client.local.DefaultPage;

          import org.jboss.errai.ui.nav.client.local.Page;

          import org.jboss.errai.ui.shared.api.annotations.Templated;

          import com.google.gwt.user.client.ui.Composite;

          @Templated

          @Page(role = DefaultPage.class)

          public class HomePage extends Composite {

          }

           

          And I have added a HomePage.html file in same package. I also have ErraiApp.properties in my resource folder.

          Problem is My app works and it print GWT log message but I don't see content from HomePage.html. Am I missing something?

           

           

          Here is Dnmp from GWT development console:

          [DEBUG] [tunedrive] - Rebinding org.jboss.errai.marshalling.client.api.MarshallerFactory

          [DEBUG] [tunedrive] - Rebinding org.jboss.errai.ioc.client.QualifierEqualityFactory

          [DEBUG] [tunedrive] - Rebinding org.jboss.errai.ioc.client.container.IOCEnvironment

          [DEBUG] [tunedrive] - Rebinding org.jboss.errai.ioc.client.Bootstrapper

          [INFO] [tunedrive] - It's working..

          [INFO] [tunedrive] - Module tunedrive has been loaded

          • 2. Re: Need Help in setting up Errai Project in Eclipse
            Max Barkley Expert

            Hi Amit,

             

            Since Errai 2.4 we are no longer using archetypes. However, based on feedback from new users like yourself, we have been working on ways to ease the "Getting Started" experience. Most of these changes are happening in Errai 3.0, so I would recommend using our newest milestone 3 release.

             

            Here are some of the resources we currently have available:

            • Here is our errai-tutorial project. It uses Errai Messaging, Errai CDI, Errai UI, Errai Navigation, Errai JPA, and Errai JAXRS. It is currently using Errai 3.0 M3, and I suggest that you base any new projects off of this one.
            • Here is a tutorial that explains in some depth how to run errai-tutorial in production mode, and how to run and debug it in development mode. And please, if you have any feedback on what these instructions are missing, we would love hear it!

             

            Currently, the best way to get started is to follow the linked tutorial, and then use the errai-tutorial project as a template (i.e. just get rid of the java source but keep the configurations). However, we are currently developing a Forge plugin that will allow users to start a new Errai project from scratch with a few simple commands! We will be releasing the first version of it with Errai 3.0 M4 sometime in February. You may want to keep an eye on our blog, where we will be announcing this (likely with an accompanying tutorial).

             

            Regarding the stacktrace you've posted, I would suggest setting up your project with a newer version of Errai. There have been a lot of improvements to stability since Errai 2.3.2 .

             

            Cheers.

            • 3. Re: Need Help in setting up Errai Project in Eclipse
              Amit Kumar Newbie

              @@Max - Thanks for quick reply.

               

              I have already looked at both tutorial project and setup guide and it works fine from mvn command line but i would like to set it up via GWt launcher "Run as webApplication" on default Jetty.

              Also, it's too much to deal with to start with a new framework.  And in my personal opinion, adding or using features of a framework one at a time will help you understand most moving parts.  You guys are living with it for few years and it might sound totally naive or absurd to you.

               

              Anyways, I compared both configuration again and i don't see any difference except server side related changes and for now i am just trying to display a dump html as default page. It seems i am close (please refer the updates from my last post) and would appreciate clue or directions.

               

              Thanks in advance.

              • 4. Re: Need Help in setting up Errai Project in Eclipse
                Max Barkley Expert

                Hi Amit,

                 

                If you're using version 2.3.2, you will have to attach the navigation panel to see pages.

                • 5. Re: Need Help in setting up Errai Project in Eclipse
                  Amit Kumar Newbie

                  I am using 3.x, below is the maven entry.

                      <dependency>

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

                      <artifactId>errai-javaee-all</artifactId>

                      <version>3.0.0.20131205-M3</version>

                      </dependency>

                   

                  Here is the good news - I got it working. The missing part was below entry in web.xml. It's surprising why do i need this entry to get UI templating  working. Shouldn't it totally independent?

                   

                  <servlet>

                          <servlet-name>ErraiServlet</servlet-name>

                          <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>

                          <init-param>

                              <param-name>auto-discover-services</param-name>

                              <param-value>true</param-value>

                          </init-param>

                          <load-on-startup>1</load-on-startup>

                      </servlet>

                      <servlet-mapping>

                          <servlet-name>ErraiServlet</servlet-name>

                          <url-pattern>*.erraiBus</url-pattern>

                      </servlet-mapping> 

                  • 6. Re: Need Help in setting up Errai Project in Eclipse
                    Max Barkley Expert

                    It's surprising why do i need this entry to get UI templating  working. Shouldn't it totally independent?

                    You're right that it should be easier to use these features independently. Although the errai-javaee-all dependency is convenient if you're using all of the Errai sub-projects, it does lack modularity.

                     

                    That's a big reason why we're working on a Forge plugin for the next release. With the plugin, it will become very easy to add a single feature of Errai to a maven project.

                    • 7. Re: Need Help in setting up Errai Project in Eclipse
                      Amit Kumar Newbie

                      As promised, here is a quick & dirty article to guide anyone with basic project setup.

                       

                      How to setup Errai Project with Eclipse, Maven, GWT plugin with Default Jetty

                       

                      Hope this will be useful

                       

                      Thanks,

                      • 8. Re: Need Help in setting up Errai Project in Eclipse
                        Max Barkley Expert

                        That's great! Thank you for taking the time to share that.