How GWT RPC loads the serialization policy files?
Asked Answered
O

3

9

I'm researching a solution for an issue with GWT and OSGi+PAX-Web. The particular problem is that GWT cannot load the serialization policy file, giving the following error:

ERROR: The serialization policy file '/ctx/ctx/6ExxxxxxxxxxxxxxxxF.gwt.rpc' was not found; did you forget to include it in this deployment?

The problem lies somewhere between Equinox OSGi and PAX-WEB.

To find a solution, I would like to better understand how GWT-RPC is loading the serialization policy files.

  • What is their lifecycle? When are they loaded? (I see it's on server startup. Any particularities in the lifecycle? Reload?)
  • How GWT loads this file in its stack? At what point in the call stack of a request? How does GWT knows where to load them from? Can I tell GWT where it should look for this file?

(disclaimer: I've read the gwt docs on the generated files [2]. I'm looking for more low-level details: I've the impressions that the error we are having has to deal with HttpContext.getResource())

Oona answered 21/6, 2012 at 14:25 Comment(0)
O
11

It's all in RemoteServiceServlet.

What is their lifecycle? When are they loaded? (I see it's on server startup. Any particularities in the lifecycle? Reload?)

They're loaded on first use (first request received) and cached in a field of the servlet, so their lifecycle is tied to the one of the servlet itself.

How GWT loads this file in its stack? At what point in the call stack of a request? How does GWT knows where to load them from? Can I tell GWT where it should look for this file?

servlet.getServletContext().getResourceAsStream. You can customize this by overriding doGetSerializationPolicy (as said in the JavaDoc).
The file name (resource URL) is built from the request's path and X-GWT-Permutation request header.

Ordinand answered 21/6, 2012 at 14:37 Comment(2)
thanks for the pointers. Good stuff. For the record, here's the link to the source. It might help as reference: code.google.com/p/google-web-toolkit/source/browse/trunk/user/…Oona
How does this work with GWT-PhoneGap remote logging? code.google.com/p/gwt-phonegap/wiki/LoggingModule the requested .gwt.rpc is on the phone. Do I have to copy it on the server or will GWT send it at any point.Cist
C
4

I looked for the .rpc file in my EAR file and found that the filename was different to the error.

Solution: cleared browser cache and refreshed.

Committeewoman answered 8/2, 2013 at 1:20 Comment(3)
so you probably had a different issue.Oona
I suspect this is the solution to the majority of people who have this problem.Longer
+1 here To me it looks that we should find a way to ask client to get fresh resources after application update.Loyalist
S
4

Answer provided my Nick worked for me.

I had my web app running with some classes for long time.

Later I have added new classes on the server and when I try to start the web app, it was giving me the following error:

ERROR: The serialization policy file '/newapp/C3055CD048198D732D03CA6901E503 86.gwt.rpc' was not found; did you forget to include it in this deployment?

WARNING: Failed to get the SerializationPolicy 'C3055CD048198D732D03CA6901E5038 6' for module 'http ://10.10.1.23:9200/newapp/'; a legacy, 1.3.3 compatible, serialization policy will be used. You may experience SerializationExceptions as a result.

Then I have started the app in incognito window, which clears the cache and it worked for me.

Seamanlike answered 10/9, 2013 at 18:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.