> What is the exception logged on the server that caused the HTTP 500 error?
That is the problem. I am not seeing any error on the server.
> should not have final fields
I did not realize this limitation. I am pretty sure there are some.
Looking at the docs, I will add transient to them.
Looking at the final comment in
https://github.com/gwtproject/gwt/issues/1062#issuecomment-210347324
It says GWT RPC is being deprecated.
Is that true?
OK, that is good to know. It might be a good idea to add a follow-up
on that comment which clarifies that GWT RPC is not deprecated.
> If there was a serialization error, it would be written out using your servlet container's own logging system
You are correct, it is a serialization error and it was in a different log.
Here is the error message:
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
Type 'com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle' 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._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle@703902c0
That is a bit cryptic and does not give details on which field was causing the problem.
I am pretty sure I am not going to be the only person who is trying to learn
GWT and runs into it. Can we add a warning to the GWT compiler which alerts
the user that they have a final field which could cause a problem?
> Note that final fields are supported in gwt-rpc, but you need to set rpc.XserializeFinalFields to true in your .gwt.xml file:
> <set-property name="rpc.XserializeFinalFields" value="true" />
I set that property, but I am still getting this serialization error:
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
Type 'com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle' 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._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle@23a80ce8
Is there a way to find out more specifically what GWT RPC does not like about
my class?
I wrote a very simple class:
package com._3dmathpuzzles.slitherlink;
import java.io.Serializable;
public class TestPuzzle implements Serializable {
private static final long serialVersionUID = 1L;
/** Constructor */
public TestPuzzle() {
super();
}
}
And updated my RPC call to use it and I still get this:
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
Type 'com._3dmathpuzzles.slitherlink.TestPuzzle' 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._3dmathpuzzles.slitherlink.TestPuzzle@40a58058
I am not sure what to do about this. My class implements Serializable
and has a no-arg constructor.
You're triggering the LegacySerializationPolicy... we should make that clearer when it happens.This occurs when your <hash>.gwt.rpc policy file wasn't present on the server (or wasnt at the expected path). Legacy serialization is much more strict in what it will accept.
I see this in the log:
com._3dmathpuzzles.play.server.GetPuzzleServiceImpl: ERROR: The module path requested, /play/DiagonalSlitherlink/, is not in the same web application as this servlet, /3dmp. Your module may not be properly configured or your client and server code maybe out of date.
Looking at the source code for RemoteServiceServlet, I see that it wants the module path to start with the
webapp context, but it does not match in my setup.
Is there a way to override the behavior, maybe load it manually or
something?
I see a method putCachedSerializationPolicy but it is private.
> The server expects the client to tell it where the file should be, and the client reports that the file should
> be in the same directory as its .nocache.js file
> we call that the "base directory" of a gwt application.
I decided to stop fighting with GWT and moved the module from Apache
to Tomcat. The test RPC started working once I did that.
I changed the code to try to retrieve my DiagonalSlitherlink puzzle, but it
it is giving me an error. I am investigating.
Thanks for the help!
I decided to stop fighting with GWT and moved the module from Apache
to Tomcat. The test RPC started working once I did that.
> Given your error message it seems that you use Apache to access your application via /play but your
> server application is deployed on context root /3dmp
Yes, that is exactly what was causing GWT to be unhappy.
I moved the GWT module into Tomcat and now it is much happier.
Thank you,