GWT Seamless Deployment
I would like to make deployment of GWT app seemless. That is when new version of the gwt app is uploaded, user which has the older version of client side code in his browser should be notified about it. Afterwards, user can refresh the browser to get the latest version.
I found the article which describes how to achieve this: http://www.draconianoverlord.com/2010/07/07/gwt-seamless-upgrades.html
The problem I face is when the rpc request is made, it fails, which is correct behaviour. But instead of getting IncompatibleRemoteServiceException
in onFailure
method, I get StatusCodeException
(500 The call failed on the server; see server log for details). Incompat开发者_运维知识库ibleRemoteServiceException
exception is thrown in server side, but client side has no info about it.
How to solve this problem?
First, I don't think this "recipe" is good. RemoteServiceServlet
gives you hooks to load the appropriate serialization policy for the request, which is meant to allow "old clients" talking to "new servers", and it should actually do the right thing by default: simply deploy the new code along side the old one (you can keep the old *.cache.html and *.cache.js for a while before deleting them, to help migrate clients seamlessly, without the GWT.runAsync
issue; what matters here is that you keep the old *.gwt.rpc files on the server).
Note however that it's much easier to do such upgrades with RequestFactory than with GWT-RPC, because RF generates stable obfuscated names between builds, that only depend on the interface or method name, not on its signature or the type and number of fields in the class (as in GWT-RPC).
Even if you rename interfaces or methods, you should be able to provide a transition path by throwing in a ServiceLayerDecorator
to do the translation from the old name to the new one.
To help diagnose your issue though: where is the IncompatibleRemoteServiceException
thrown on the server side? where is it handled there? and what appears in your server log?
Disclaimer: I never actually deployed anything with GWT-RPC besides prototypes, where seamless upgrades weren't needed, so the above is more like a guess after reading the code for GWT-RPC internals.
精彩评论