7 Replies Latest reply on Sep 10, 2011 11:06 AM by Mike Brock

    Deserialisation

    koekj Newbie

      I'm trying to get errai up and running on an jboss as 7 environment with use of CDI,EJB's and JPA.

      My dependency list


      <dependencies>


      <dependency>



      <groupId>org.jboss.spec</groupId>



      <artifactId>jboss-javaee-6.0</artifactId>



      <type>pom</type>


      </dependency>

       

       



      <!-- GWT and GWT Extensions -->


      <dependency>



      <groupId>com.google.gwt</groupId>



      <artifactId>gwt-servlet</artifactId>



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



      <scope>runtime</scope>


      </dependency>


      <dependency>



      <groupId>com.google.gwt</groupId>



      <artifactId>gwt-user</artifactId>



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



      <scope>provided</scope>


      </dependency>


      <dependency>



      <groupId>org.slf4j</groupId>



      <artifactId>slf4j-api</artifactId>


      </dependency>


      <dependency>



      <groupId>junit</groupId>



      <artifactId>junit</artifactId>


      </dependency>


      <dependency>



      <groupId>org.slf4j</groupId>



      <artifactId>slf4j-log4j12</artifactId>


      </dependency>


      <dependency>



      <groupId>commons-beanutils</groupId>



      <artifactId>commons-beanutils</artifactId>



      <scope>compile</scope>


      </dependency>


      <dependency>



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



      <artifactId>errai-widgets</artifactId>



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


      </dependency>


      <dependency>



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



      <artifactId>errai-weld-integration</artifactId>



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


      </dependency>


      <dependency>



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



      <artifactId>errai-tools</artifactId>



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


      </dependency>


      <dependency>



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



      <artifactId>errai-persistence</artifactId>



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


      </dependency>


      <dependency>



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



      <artifactId>errai-javax-enterprise</artifactId>



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


      </dependency>


      <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-common</artifactId>



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


      </dependency>


      <dependency>



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



      <artifactId>errai-cdi-jetty</artifactId>



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



      <scope>provided</scope>


      </dependency>


      <dependency>



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



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



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


      </dependency>


      <dependency>



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



      <artifactId>errai-bus</artifactId>



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


      </dependency>

       

      I'm able to inject the EJB into the CDI component that is used as service for the errai client;

       

      @Service

      public class HelloWorldService implements MessageCallback {

       

            private RequestDispatcher requestDispatcher;

       

       

        @Inject

        ArticleDAOBean bean;

       

       

        public void callback(Message message) {

        try {

        LOGGER.info("Bean is {}", (bean == null ? "null" : "set!"));

        List<Article> articleList = bean.find(0, 50);

        MessageBuilder.createConversation(message).subjectProvided()

        .with("Records",

        list

        ).noErrorHandling()

        .reply();

        LOGGER.info( "Message has been sent, attached:{}", articleList.size() );

        } catch ( Throwable e ) {

        e.printStackTrace();

        LOGGER.info( "Bug?:" + e.getMessage() );

        }

        }

       

       

        @Inject

        public void setRequestDispatcher(RequestDispatcher requestDispatcher) {

        this.requestDispatcher = requestDispatcher;

        }

       

       

        public RequestDispatcher getRequestDispatcher() {

        return requestDispatcher;

        }

      }

       

       

      As you can see I'm using the example code coming with the maven archetype.

       

      I have annotated the entity with @ExposedEntity and this results in a generated marshaller en demarshaller (stored in the folder .generated\org\jboss\errai\bus\client\ext).

       

      I can stated that the marshaller is working because if I look into firefox firebug I'm seeing the data being sent as json string to the client.

       

      However the client (GWT) is not receiving the message. I added an Window.alert to the code to ensure that the message is processed.

      If I'm sending a regular String the client is responding.

       

      So which pointers can you give to debug and to find the problem. I'm expecting that the problem lies in the demarshalling of the objects.

      In the generated code the following statements are generated;

       

        catch (Exception e) {

                      e.printStackTrace();

                      throw new RuntimeException("could not demarshall type: Article; value=" + o, e);

                  }

       

      Does that work for GWT?

       

      I have tried to startup the monitor but that doesn't start within the jboss as 7. In the war under WEB-INF/lib the errai-tools.jar is available.

      And in the standalone.conf.bat the set "JAVA_OPTS=%JAVA_OPTS% -Derrai.tools.bus_monitor_attach=true" is added.

      The exception that is returned:

      java.lang.RuntimeException: could not initialize ErraiService instance

                at org.jboss.errai.cdi.server.Util.lookupErraiService(Util.java:142)

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

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:619)

      Caused by: com.google.inject.ProvisionException: Guice provision errors:

       

       

      1) Error injecting constructor, java.lang.RuntimeException: Server bootstrap failed

        at org.jboss.errai.bus.server.service.ErraiServiceImpl.<init>(ErraiServiceImpl.java:51)

        at org.jboss.errai.bus.server.service.ErraiServiceImpl.class(ErraiServiceImpl.java:51)

        while locating org.jboss.errai.bus.server.service.ErraiServiceImpl

        while locating org.jboss.errai.bus.server.service.ErraiService

       

       

      1 error

                at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)

                at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)

                at org.jboss.errai.container.ServiceFactory.create(ServiceFactory.java:35)

                at org.jboss.errai.cdi.server.Util.lookupErraiService(Util.java:136)

                ... 26 more

      Caused by: java.lang.RuntimeException: Server bootstrap failed

                at org.jboss.errai.bus.server.service.bootstrap.OrderedBootstrap.execute(OrderedBootstrap.java:71)

                at org.jboss.errai.bus.server.service.ErraiServiceImpl.boostrap(ErraiServiceImpl.java:60)

                at org.jboss.errai.bus.server.service.ErraiServiceImpl.<init>(ErraiServiceImpl.java:55)

                at org.jboss.errai.bus.server.service.ErraiServiceImpl$$FastClassByGuice$$7879947c.newInstance(<generated>)

                at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

                at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

                at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

                at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

                at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

                at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

                at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

                at com.google.inject.Scopes$1$1.get(Scopes.java:65)

                at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

                at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)

                at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)

                at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)

                at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)

                ... 29 more

      Caused by: org.jboss.errai.bus.server.ErraiBootstrapFailure: could not initialize extension: org.jboss.errai.tools.monitoring.MonitorExtension

                at org.jboss.errai.bus.server.service.bootstrap.LoadExtensions.execute(LoadExtensions.java:121)

                at org.jboss.errai.bus.server.service.bootstrap.OrderedBootstrap.execute(OrderedBootstrap.java:57)

                ... 45 more

      Caused by: java.lang.IllegalArgumentException

                at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:589)

                at java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:480)

                at org.jboss.errai.tools.monitoring.ActivityProcessor.<init>(ActivityProcessor.java:34)

                at org.jboss.errai.tools.monitoring.MonitorExtension.configure(MonitorExtension.java:44)

                at org.jboss.errai.bus.server.service.bootstrap.LoadExtensions$2.run(LoadExtensions.java:105)

                at org.jboss.errai.bus.server.service.bootstrap.LoadExtensions.execute(LoadExtensions.java:112)

                ... 46 more

       

       

      Hope you can help, so that I can help getting this great framework working.