I have just run into almost exact same problem. After doing a little
digging I discovered that the problem arises in the static method
RemoteServiceServlet.loadSerializationPolicy(...).

As an example in the setup you have you are performing the following
mapping:

http://www.example.com/somefile.html -> 
http://dev.site.com:8080/siteGwt/somefile.html

Internally GWT takes the module base URL which is passed from the
client (http://www.example.com/) gets the path part of the URL and
uses it as the module path (in this case /). In order to find the
serialization policy GWT checks that !
modulePath.startsWith(contextPath) which is obviously not the case and
as a result fails printing friendly error message to your log file and
returns a null SerializationPolicy.

The solution I'm using will not work in your case (my configuration
adds information to the module base url instead of removing it) but
the principle will. I have an IntermediateRemoteServiceServlet that
extends RemoteServiceServlet and then all my service implementations
extend IntermediateRemoteServiceServlet instead. Then all that is
required is an override of the protected
RemoteServiceServlet.doGetSerializationPolicy that calls
loadSerializationPolicy after performing some URL magic:

public class IntermediateRemoteServiceServlet extends
RemoteServiceServlet {
        protected SerializationPolicy doGetSerializationPolicy(
                HttpServletRequest request, String moduleBaseURL, String 
strongName)
{

                String contextPath = request.getContextPath();
                URI uri = new URI(moduleBaseURL);
                String modulePath = uri.getPath();

                int contextIndex = modulePath.indexOf(contextPath);
                if(contextIndex < 0) {
                        modulePath = contextPath + modulePath;
                }
                else if(contextIndex > 0) {
                        modulePath = modulePath.substring(contextIndex);
                }

                uri = new URI(uri.getScheme(), uri.getAuthority(), modulePath,
uri.getQuery(), uri.getFragment());

                return loadSerializationPolicy(this, request, uri.toString(),
strongName);
        }
}

public class SomeServiceImpl extends IntermediateRemoteServiceServlet
{
        // ...
}

This solution is by no means perfect and will require some tweaking
based on your individual requirements but it will get the job done.

Kevin

On Jan 24, 1:51 pm, siberian <[email protected]> wrote:
> I have a GWT app that works fine under tomcat when it is hit directly
> on 8080 but when accessed via mod-proxy I get serialization errors
>
> My proxy config is:
>
> ------cut------
> ProxyRequests       Off
> ProxyPreserveHost On
>
> ProxyPass /    http://dev.site.com:8080/siteGwt/
> ProxyPassReverse  /    http://dev.site.com:8080/siteGwt/
> ------cut------
>
> The error given is
>
> ------cut------
> ==> /usr/local/tomcat/logs/localhost.2010-01-24.log <==
> Jan 24, 2010 10:18:10 AM org.apache.catalina.core.ApplicationContext
> log
> SEVERE: Exception while dispatching incoming RPC call
> com.google.gwt.user.client.rpc.SerializationException: Type
> 'com.pgi.webapp.client.model.PGAdmin' was not assignable to
> 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a
> custom field serializer.For security purposes, this type will not be
> serialized.: instance = com.pgi.webapp.client.model.pgad...@e0795
> ------cut------
>
> If I added 'implements com.google.gwt.user.client.rpc.IsSerializable'
> to my models everything works fine but this is not possible for some
> of the components I am using (gxt specifically) which make this route
> impractical for us.
>
> So, the question is, how can I make my GWT app work the same undermod_proxyas 
> it does when directly accessed?
>
> This is stopping progress on the project since our other developers
> can't get started until we can deploy this cleanly :(
>
> Tx for any help
> John

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to