Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Exception while dispatching incoming RPC call

2,206 views
Skip to first unread message

Charles Nelson

unread,
Apr 23, 2014, 7:16:14 PM4/23/14
to google-we...@googlegroups.com
I have an app that works perfectly in my development environment of eclipse/jetty. It also work fine when I deploy it locally to tomcat 7 on my development machine. But it fails on my production server with the following error,

...
SEVERE: Exception while dispatching incoming RPC call
at com.google.gwt.user.server.
rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
SEVERE: Exception while dispatching incoming RPC call
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
SEVERE: Exception while dispatching incoming RPC call
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
...

Help!

Thanks!

Davide Micheletti

unread,
Apr 24, 2014, 5:59:58 AM4/24/14
to google-we...@googlegroups.com
what's the code at RPC.java:579? 

if you have a DB, does the app connect succesfully to the DB??


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Charles Nelson

unread,
Apr 24, 2014, 7:14:09 AM4/24/14
to google-we...@googlegroups.com
Hmm, I didn't know what is the code at RPC.java was because it's part of the GWT SDK and is supplied as a class in a jar file. But I did find the relevant source code on the web and snippets from it are shown below. The actual RPC.java is attached to this message. The error I'm getting seems to suggest that there may be an issue with the serialization policy file. But if that is true then why doesn't it fail on my local machine? Also I am using Berkeley DB and the RPC mechanism does not directly interact with it. No hibernate or other ORM's involved here.

   /**
   * Returns a string that encodes the result of calling a service method, which
   * could be the value returned by the method or an exception thrown by it.
   *
   * <p>
   * If the serializationPolicy parameter is not <code>null</code>, it is used to
   * determine what types can be encoded as part of this response. If this
   * parameter is <code>null</code>, then only subtypes of
   * {@link com.google.gwt.user.client.rpc.IsSerializable IsSerializable} or
   * types which have custom field serializers may be encoded.
   * </p>
   *
   * <p>
   * This method does no security checking; security checking must be done on
   * the method prior to this invocation.
   * </p>
   *
   * @param target instance on which to invoke the serviceMethod
   * @param serviceMethod the method to invoke
   * @param args arguments used for the method invocation
   * @param serializationPolicy determines the serialization policy to be used
   * @return a string which encodes either the method's return or a checked
   *         exception thrown by the method
   *
   * @throws NullPointerException if the serviceMethod or the
   *           serializationPolicy are <code>null</code>
   * @throws SecurityException if the method cannot be accessed or if the number
   *           or type of actual and formal arguments differ
   * @throws SerializationException if an object could not be serialized by the
   *           stream
   * @throws UnexpectedException if the serviceMethod throws a checked exception
   *           that is not declared in its signature
   */
  public static String invokeAndEncodeResponse(Object target,
      Method serviceMethod, Object[] args,
      SerializationPolicy serializationPolicy) throws SerializationException {
    if (serviceMethod == null) {
      throw new NullPointerException("serviceMethod");
    }

    if (serializationPolicy == null) {
      throw new NullPointerException("serializationPolicy");
    }

    String responsePayload;
    try {
      Object result = serviceMethod.invoke(target, args);

      responsePayload = encodeResponseForSuccess(serviceMethod, result,
          serializationPolicy);
    } catch (IllegalAccessException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalAccessErrorMessage(target, serviceMethod));
      securityException.initCause(e);
      throw securityException;
    } catch (IllegalArgumentException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalArgumentErrorMessage(target, serviceMethod, args));
      securityException.initCause(e);
      throw securityException;
    } catch (InvocationTargetException e) {
      // Try to encode the caught exception
      //
      Throwable cause = e.getCause();

      responsePayload = encodeResponseForFailure(serviceMethod, cause,
          serializationPolicy);
    }

    return responsePayload;
  }

  /**
   * Returns a string that encodes the results of an RPC call. Private overload
   * that takes a flag signaling the preamble of the response payload.
   *
   * @param object the object that we wish to send back to the client
   * @param wasThrown if true, the object being returned was an exception thrown
   *          by the service method; if false, it was the result of the service
   *          method's invocation
   * @return a string that encodes the response from a service method
   * @throws SerializationException if the object cannot be serialized
   */
  private static String encodeResponse(Class responseClass, Object object,
      boolean wasThrown, SerializationPolicy serializationPolicy)
      throws SerializationException {

    ServerSerializationStreamWriter stream = new ServerSerializationStreamWriter(
        serializationPolicy);

    stream.prepareToWrite();
    if (responseClass != void.class) {
      stream.serializeValue(object, responseClass);
    }

    String bufferStr = (wasThrown ? "//EX" : "//OK") + stream.toString();
    return bufferStr;
  }



--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/l5oDVXaRd90/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
RPC.java

Jens

unread,
Apr 24, 2014, 7:39:53 AM4/24/14
to google-we...@googlegroups.com
 The error I'm getting seems to suggest that there may be an issue with the serialization policy file. But if that is true then why doesn't it fail on my local machine?

You should see a log entry saying that the serialization policy file could not be loaded. That log entry only appears once when you do the very first GWT-RPC request.

If your production deployment does not meet GWT's standard assumption on how to load that file you can override RemoteServiceServlet.doGetSerializationPolicy().

-- J.

Charles Nelson

unread,
Apr 24, 2014, 1:44:27 PM4/24/14
to google-we...@googlegroups.com
I've tried manually setting the service URL with setServiceEntryPoint(URL), ensuring the ServletContext.getResource() call and overriding the  RemoteServiceServlet.doGetSerializationPolicy() methods but  my app still fails on my hosting company's server. And they aren't providing access to the tomcat logs so I can't determine what's failing. This is my 1st pure GWT-RPC app. My other apps use GWT-HTTP for the client side and uses grails for the server side and I haven't had any issues with tomcat.

Right now I'm lost...


--

Michael Joyner

unread,
Apr 24, 2014, 1:59:38 PM4/24/14
to google-we...@googlegroups.com
On 04/24/2014 01:44 PM, Charles Nelson wrote:
> I've tried manually setting the service URL with
> setServiceEntryPoint(URL), ensuring the ServletContext.getResource()
> call and overriding the
> RemoteServiceServlet.doGetSerializationPolicy() methods but my app
> still fails on my hosting company's server. And they aren't providing
> access to the tomcat logs so I can't determine what's failing. This is
> my 1st pure GWT-RPC app. My other apps use GWT-HTTP for the client
> side and uses grails for the server side and I haven't had any issues
> with tomcat.
>
> Right now I'm lost...
>
Is your web exposed War deploy path the same as the Tomcat context path?

I have a system here I have to override the module base on the server
side with:

@Override
protected SerializationPolicy doGetSerializationPolicy(
HttpServletRequest request, String moduleBaseURL, String
strongName) {
moduleBaseURL=request.getScheme()+"://"+request.getServerName()+(new
File(request.getRequestURI()).getParent()+"/");
// System.out.println("MUNGED moduleBaseURL: "+moduleBaseURL);
return super.doGetSerializationPolicy(request, moduleBaseURL,
strongName);
}
Reply all
Reply to author
Forward
0 new messages