4 Replies Latest reply: Jan 21, 2013 4:47 PM by Thomas Frühbeck RSS

message delivered twice to server side service

Thomas Frühbeck Newbie

I am currently working with server side persistence JPA, and received on update an optimistic locking error.

During investigation I seem to get the message delivered twice.

 

It seems, that the DeliveryPlan finds two destinations:

  public void deliver(final Message m) {

    for (MessageCallback callback : deliverTo) {

      callback.callback(m);

    }

  }

 

To show what happens I made the tread dumps:

 

First delivery:

 

17:25:35,864 ERROR [stderr] (http--0.0.0.0-8080-8)  at java.lang.Thread.dumpStack(Thread.java:1342)
17:25:35,865 ERROR [stderr] (http--0.0.0.0-8080-8)  at at.tfr.aero2.server.ParentServiceImpl.update(ParentServiceImpl.java:55)
17:25:35,867 ERROR [stderr] (http--0.0.0.0-8080-8)  at at.tfr.aero2.server.ParentServiceImpl.update(ParentServiceImpl.java:1)
17:25:35,868 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:25:35,869 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:25:35,870 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:25:35,871 ERROR [stderr] (http--0.0.0.0-8080-8)  at java.lang.reflect.Method.invoke(Method.java:601)
17:25:35,872 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.io.ConversationalEndpointCallback.callback(ConversationalEndpointCallback.java:114)
17:25:35,873 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
17:25:35,874 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)
17:25:35,875 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)
17:25:35,876 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)
17:25:35,877 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)
17:25:35,879 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)
17:25:35,880 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)
17:25:35,881 ERROR [stderr] (http--0.0.0.0-8080-8)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

 

Second delivery:

17:25:46,860 ERROR [stderr] (http--0.0.0.0-8080-8)  at java.lang.Thread.dumpStack(Thread.java:1342)
17:25:46,861 ERROR [stderr] (http--0.0.0.0-8080-8)  at at.tfr.aero2.server.ParentServiceImpl.update(ParentServiceImpl.java:55)
17:25:46,863 ERROR [stderr] (http--0.0.0.0-8080-8)  at at.tfr.aero2.server.ParentServiceImpl.update(ParentServiceImpl.java:1)
17:25:46,864 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:25:46,865 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:25:46,866 ERROR [stderr] (http--0.0.0.0-8080-8)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:25:46,867 ERROR [stderr] (http--0.0.0.0-8080-8)  at java.lang.reflect.Method.invoke(Method.java:601)
17:25:46,869 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.io.ConversationalEndpointCallback.callback(ConversationalEndpointCallback.java:114)
17:25:46,871 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
17:25:46,872 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:512)
17:25:46,873 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)
17:25:46,874 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)
17:25:46,875 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)
17:25:46,876 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)
17:25:46,878 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)
17:25:46,879 ERROR [stderr] (http--0.0.0.0-8080-8)  at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)
17:25:46,880 ERROR [stderr] (http--0.0.0.0-8080-8)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

 

I use the @Remote on the interface and the  @Service annotation on the impl.

 

What can I do to remedy this?

 

Thanks,

Thomas

  • 1. Re: message delivered twice to server side service
    Mike Brock Master

    What version of Errai are you running?

     

    Also, is there more details you can provide about your actual code itself? This is not an issue we've seen before.

  • 2. Re: message delivered twice to server side service
    Thomas Frühbeck Newbie

    Debugging confirms 2 entries in DeliveryPlan.deliverTo:

     

          [org.jboss.errai.bus.server.io.RemoteServiceCallback@26a1c5ff, org.jboss.errai.cdi.server.CDIExtensionPoints$3@44357d22]

  • 3. Re: message delivered twice to server side service
    Thomas Frühbeck Newbie

    sorry, I was still waiting for my 900 seconds to expire :-)

    My setup:

      <errai.version>2.2.0.CR2</errai.version>
      <gwt.version>2.4.0</gwt.version>
      <slf4j.version>1.5.11</slf4j.version>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <javaee.version>3.0.1.Final</javaee.version>

     

    The button I press:

       @DataField

       Button update = new Button("Update");

     

    The invokation:

     

      update.addClickHandler(new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
            try {
               GWT.log("calling entityService");
               getEntityService().call(
                       new RemoteCallback<T>() {
                          @Override
                          public void callback(T response) {
                             GWT.log("updated Entity: " + response);
                             updateView(response);
                          }
                     },
                    new ErrorCallback() {
                          @Override
                          public boolean error(Message message, Throwable throwable) {
                             GWT.log("EntityServiceError: ", throwable);
                             Window.alert(message.toString());
                             return false;
                          }
                       }).update(entity.getId(), entity);
            } catch (Exception e) {
               GWT.log("EntityService: ", e);
            }
         }
      });
  • 4. Re: message delivered twice to server side service
    Thomas Frühbeck Newbie

    The problem has been solved after setting "errai.marshalling.use_static_marshallers" in ErraiApp.properties.

    My code contains MappingDefinitions, which were compiled and interpreted by GWT during hosted DevMode.

    Possibly there is some connection??

    I personally can't imagine, but it works now