3 Replies Latest reply on Oct 19, 2011 10:53 AM by Christian Sadilek

    Help getting 3.1.0.CR1 CDI archetype into eclipse

    Alan Midona Newbie

      My problem is very simillar to http://community.jboss.org/thread/173092.

       

      I have created a project based on the 3.1.0.CR1 CDI archetype.   I have had it run inder jetty using:

       

      mvn: gwt:run

       

      and I have had it run under JBoss using:

       

      mvn -Pjboss7 clean install

      (+ installed from the admin consol)

       

      But I can't seem to get it to run from eclipse (Helios).   I followed all of the steps taken in the other thread, but I get the different errors when i try to run it:

       

      =================

      SLF4J: Class path contains multiple SLF4J bindings.

      SLF4J: Found binding in [jar:file:/C:/CleanStart/owr2/war/WEB-INF/lib/slf4j-log4j12-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]

      SLF4J: Found binding in [jar:file:/C:/CleanStart/owr2/war/WEB-INF/lib/weld-servlet-1.1.0.Final.jar!/org/slf4j/impl/StaticLoggerBinder.class]

      SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

      14:23:49,061 INFO  [weld.Version] WELD-000900 1.1.0 (Final)

      14:23:49,185 INFO  [weld.Bootstrap] WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

      14:23:49,518 INFO  [server.CDIExtensionPoints] Created Errai-CDI context: c143ba59-d366-4691-bc8c-53b787fe0934

      14:23:49,550 INFO  [container.DevModeCDIBootstrap] Jetty detected, JSR-299 injection will be available in Servlets and Filters. Injection into Listeners is not supported.

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

         [WARN] Adding classpath entry 'file:/C:/Users/OptaAdmin/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar' to the web app classpath for this session

      14:23:49,698 INFO  [ErraiJNDI] searching to see if ErraiService is already bound...

      14:23:49,705 INFO  [ErraiJNDI] attempting to bind ErraiService to JNDI context: java:global/ErraiService ... failed: global is not bound

      14:23:49,705 INFO  [ErraiJNDI] attempting to bind ErraiService to JNDI context: java:comp/env/ErraiService ... failed: env is not bound

      14:23:49,705 INFO  [ErraiJNDI] attempting to bind ErraiService to JNDI context: java:comp/ErraiService ... success.

      14:23:49,973 INFO  [metadata.PackagingUtil] identifying deployment type for uri: /C:/CleanStart/owr2/war/WEB-INF/classes/

      14:23:49,973 INFO  [metadata.PackagingUtil] identifying deployment type for uri: /C:/CleanStart/owr2/war/WEB-INF/lib/errai-cdi-client-1.3.0.CR1.jar

      14:23:49,974 INFO  [metadata.PackagingUtil] identifying deployment type for uri: /C:/CleanStart/owr2/war/WEB-INF/lib/errai-ioc-1.3.0.CR1.jar

      14:23:49,974 INFO  [metadata.PackagingUtil] identifying deployment type for uri: /C:/CleanStart/owr2/war/WEB-INF/lib/errai-tools-1.3.0.CR1.jar

      14:23:49,974 INFO  [metadata.PackagingUtil] identifying deployment type for uri: /C:/CleanStart/owr2/war/WEB-INF/lib/errai-weld-integration-1.3.0.CR1.jar

      14:23:50,529 INFO  [reflections.Reflections] Reflections took 542 ms to scan 5 urls, producing 193 keys and 574 values

      14:23:50,902 INFO  [reflections.Reflections] Reflections took 373 ms to scan 5 urls, producing 193 keys and 574 values

      14:23:50,911 INFO  [bootstrap.OrderedBootstrap] Bootstrap Errai

      14:23:50,911 INFO  [bootstrap.OrderedBootstrap] Working directory: C:\CleanStart\owr2\war

      14:23:50,930 INFO  [bootstrap.DefaultComponents] authentication adapter configured: org.jboss.errai.bus.server.security.auth.JAASAdapter

      14:23:50,939 INFO  [bootstrap.DefaultComponents] using dispatcher implementation: org.jboss.errai.bus.server.AsyncDispatcher

      14:23:50,945 INFO  [server.WorkerFactory] initializing async worker pools (poolSize: 5; workerTimeout: 5000)

      14:23:50,946 INFO  [server.WorkerFactory] starting worker pool.

      14:23:50,948 INFO  [bootstrap.DefaultComponents] using session provider implementation: org.jboss.errai.bus.server.HttpSessionProvider

      14:23:50,953 INFO  [bootstrap.LoadExtensions] searching for Errai extensions ...

      14:23:50,958 INFO  [bootstrap.LoadExtensions] found extension org.jboss.errai.tools.monitoring.MonitorExtension

      14:23:50,965 INFO  [bootstrap.LoadExtensions] added extension binding: org.jboss.errai.bus.server.security.auth.AuthenticationAdapter

      14:23:50,965 INFO  [bootstrap.AuthenticationRules] authentication for all requests required, adding rule ...

      14:23:50,977 INFO  [bootstrap.DiscoverServices] auto-discovery of services disabled.

      14:23:50,977 INFO  [bootstrap.BootstrapContext] Running deferred bootstrap tasks ...

      14:23:50,977 INFO  [bootstrap.OrderedBootstrap] Bootstrap complete. Ready to rumble!

      14:23:50,977 INFO  [ErraiJNDI] found ErraiService bound at: java:comp/ErraiService

      14:23:50,986 WARN  [server.ContextManager] BoundRequestContext not found. ContextManager will not be available.

      Starting Jetty on port 8888

         [WARN] unavailable

      java.lang.RuntimeException: Failed to create service

          at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.init(AbstractErraiServlet.java:98)

          at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)

          at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)

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

          at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)

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

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

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

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

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

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

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

      Caused by: java.lang.RuntimeException: Failed to locate BeanManager

          at org.jboss.errai.cdi.server.Util.lookupBeanManager(Util.java:200)

          at org.jboss.errai.cdi.server.CDIServiceLocator.locateService(CDIServiceLocator.java:15)

          at org.jboss.errai.bus.server.servlet.AbstractErraiServlet.init(AbstractErraiServlet.java:95)

          ... 21 more

      Caused by: javax.naming.NameNotFoundException; remaining name 'BeanManager'

          at org.mortbay.naming.NamingContext.lookup(NamingContext.java:578)

          at org.mortbay.naming.NamingContext.lookup(NamingContext.java:665)

          at org.mortbay.naming.NamingContext.lookup(NamingContext.java:680)

          at org.mortbay.naming.java.javaRootURLContext.lookup(javaRootURLContext.java:112)

          at javax.naming.InitialContext.lookup(Unknown Source)

          at org.jboss.errai.cdi.server.Util.lookupBeanManager(Util.java:187)

          ... 23 more

      =================

       

      What am I doing wrong?

       

      BTW, I did build a project using the 3.1.0.CR1 bus-quickstart archetype and had that up and running sucessfully in all three cases.

       

      Many thanks,

       

      Alan.

        • 1. Re: Help getting 3.1.0.CR1 CDI archetype into eclipse
          Christian Sadilek Master

          Make sure the Jetty profile is active before starting it in Eclipse. You can execute "mvn clean gwt:run" and refresh your folders in Eclipse. Also make sure you provided the JettyLauncher when starting an Errai-CDI App: -server org.jboss.errai.cdi.server.gwt.JettyLauncher

          • 2. Re: Help getting 3.1.0.CR1 CDI archetype into eclipse
            Alan Midona Newbie

            Hi Christian,

             

            I read your response and thought "yup...that's exactly what I did".   But, just to make sure I tried it again from scratch.   I used maven to create the project, ran it under Jetty using "mvn gwt:run", imported it into eclipse and hey-presto it worked!  This confused the hell out of me as I was sure this was what I'd been doing earlier.  I played around some more and it stopped working :-(.   I've narrowed down the problems and it seemed to be related to the jboss build and to profiles in general.

             

            It seems that "mvn clean gwt:run" is not enough to get rid of some of the things introduced by the jboss build.   You have to do a "mvn -Pjetty clean install" first.

             

            Many thanks.

             

            Alan.

            • 3. Re: Help getting 3.1.0.CR1 CDI archetype into eclipse
              Christian Sadilek Master

              Yes, it's the jetty-env.xml (JNDI settings for Errai and the Beanmanager) that gets copied to war/WEB-INF only when the Jetty profile is active. It's active by default though. So after using the JBoss profile one has to switch back to the Jetty profile before running development mode.