Mabedan
Mabedan

Reputation: 907

How to fix RPC error IncompatibleRemoteServiceException in a multi-project GWT setup?

I've decided to split my client server gwt project into 3 separate mvn projects:

the shared component contains all the model classes, Service interfaces, and ServiceAsync interfaces. This project is declared as dependency for both server and client gwt projects. Everything compiles fine, and the client application runs correctly. The client also makes the correct rpc request, but server responds with:

com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","Type name elision in RPC payloads is only supported if the RPC whitelist file is used."

What can the problem be? should I configure something differently in my servlet implementation?

Upvotes: 2

Views: 1510

Answers (2)

mcosta
mcosta

Reputation: 137

May be the browser is caching the .nochache.js files.

EDIT:

I just remember a time this happened. This is a vague memory... Is the servlet on the correct path? is the client requesting the correct url?

Services for module ModA looks in deploy/ModA/rpcPolicyManifest/manifests. Servlets should be mapped to /ModA/service, Clients must request to http://example.com/webapp/ModA/service.

Upvotes: 0

Andrei
Andrei

Reputation: 1635

It means that for whatever reason, your *.gwt.rpc files could not be loaded (i.e. they're either not present or perhaps not accessible through their expected URL). This probably means that you've got their location wrong after the split.

The error your receive is only present in a class called com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy which gets loaded if something happens with the regular policy files. From the javadoc:

A serialization policy compatible with GWT 1.3.3 RPC. This is used when no serialization policy file is present.

In the same class, we have:

  private static final String ELISION_ERROR = "Type name elision in RPC "
      + "payloads is only supported if the RPC whitelist file is used.";

...and also stuff like:

  /**
   * Implemented to fail with a useful error message.
   */
  public final String getClassNameForTypeId(String id)
      throws SerializationException {
    throw new SerializationException(ELISION_ERROR);
  }

So it looks like this is deliberate, although the error message is ironically not very useful.

You can run a debugger through RemoteServiceServlet#loadSerializationPolicy and see why its not loading the policy files you expect it to.

Upvotes: 1

Related Questions