Making RPC calls local tomcat server from hosted mode (1.4RC2)

112 views
Skip to first unread message

Andrew Gillett

unread,
Aug 22, 2007, 9:24:20 PM8/22/07
to Google Web Toolkit
Up until 1.4RC2, I have been able to debug using hosted mode as
follows:

I deploy all my server code to the local tomcat which runs on port
8080.

In my client, I have this code:
ServiceDefTarget endpoint = (ServiceDefTarget)myService;
if (GWT.isScript())
endpoint.setServiceEntryPoint("client");
else
endpoint.setServiceEntryPoint("http://localhost:8080/myservlet/
client");

With this arrangement, my host-mode RPC calls are directed to my local
Tomcat instance. This worked very well until the latest release
candidate.

With 1.4RC2, the RPC calls fail with:
com.google.gwt.user.client.rpc.InvocationException: The call failed on
the server; see server log for details.

The server log says:
23/08/2007 11:08:36 org.apache.catalina.core.ApplicationContext log
INFO: ERROR: The module path requested, /Client/, is not in the same
web application as this servlet, /myservlet. Your module may not be
properly configured or your client and server code maybe out of date.
23/08/2007 11:08:36 org.apache.catalina.core.ApplicationContext log
INFO: WARNING: Failed to get the SerializationPolicy
'E41BA6A4574FE48371584B5B5E3B0124' for module 'http://localhost:8889/
Client/'; a legacy, 1.3.3 compatible, serialization policy will be
used. You may experience SerializationExceptions as a result.
23/08/2007 11:08:36 org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
...

I'm guessing that with the latest release that RPC calls from the
hosted mode browser can only be made to its embedded tomcat server. Is
this the case? Or is there another approach that I should use
instead?

Andrew

Miguel Méndez

unread,
Aug 23, 2007, 9:17:19 AM8/23/07
to Google-We...@googlegroups.com
The restriction is that the serialization policy file, 'E41BA6A4574FE48371584B5B5E3B0124.gwt.rpc' in this case, be in the same web application that contains the static resources and the RPC servlet.  It determines if this is true by making sure that the module path specified in the RPC request starts with the same context path of the HTTP request.  It looks like this is not case here.

It will work if you put your servlet at /Client/myservlet.  If you need more control over the lookup process you can always override the RemoteServiceServlet.doGetSerializationPolicy(HttpServletRequest, String, String) method.

HTH,
Reply all
Reply to author
Forward
0 new messages