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

    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

       

       

      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 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.(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.