Neil Aggarwal <ne...@propfinancing.com>: Dec 17 05:43PM -0600
Now, when I call my service, I am getting this error:
500 500 The call failed on the server; see server log for details
Here is the code in my service:
public Puzzle getPuzzle(String category) {
try {
Puzzle puzzle =
(Puzzle)FileUtil.deSerialize(PathUtil.PUZZLES_DIR+"/DiagonalSlitherlink/Ch
allenging/DiagonalSlitherlink-00001-3.ser");
LogManager.getLogger(getClass()).warn("Loaded puzzle "+puzzle);
return puzzle;
} catch( Exception e ) {
LogManager.getLogger(getClass()).error(e);
return null;
}
}
My server log has this:
WARN: Loaded puzzle
com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle@3f8ef4a0
The only code after that line is the return.
Does GWT not like that I am returning a subclass which is referenced by a
superclass reference?
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 17 10:48PM -0600
It does not seem related to the reference being a superclass.
I added a second servlet which uses a reference to
RectangularWithDiagonalsPuzzle
directly.
@WebServlet(urlPatterns="/DiagonalSlitherlink/GetDiagonalSlitherlink")
public class GetDiagonalSlitherlinkImpl extends RemoteServiceServlet
implements GetDiagonalSlitherlink {
private static final long serialVersionUID = 1L;
public RectangularWithDiagonalsPuzzle getPuzzle(String category) {
try {
RectangularWithDiagonalsPuzzle puzzle =
(RectangularWithDiagonalsPuzzle)FileUtil.deSerialize(PathUtil.PUZZLES_DIR+
"/DiagonalSlitherlink/Challenging/DiagonalSlitherlink-00001-3.ser");
LogManager.getLogger(getClass()).warn("In DiagonalSlitherlinkImpl,
Loaded puzzle "+puzzle);
return puzzle;
} catch( Exception e ) {
LogManager.getLogger(getClass()).error(e);
return null;
}
}
}
And I see this in the server log:
WARN: In DiagonalSlitherlinkImpl, Loaded puzzle
com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle@76c929a9
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
> public Puzzle getPuzzle(String category) {
> try {
> Puzzle puzzle =
(Puzzle)FileUtil.deSerialize(PathUtil.PUZZLES_DIR+"/DiagonalSlitherlink/Ch
allengi
> com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle@3f8ef4a0
> The only code after that line is the return.
> Does GWT not like that I am returning a subclass which is referenced by
a
> Neil
> --
> Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com We offer 30
year
|
Jens <jens.ne...@gmail.com>: Dec 18 04:33AM -0800
What is the exception logged on the server that caused the HTTP 500 error?
Generally your classes and their field references must implement
Serializable, have a default constructor (can be private) and should not
have final fields. Is that the case for RectangularWithDiagonalsPuzzle and
its super classes?
-- J.
Neil Aggarwal schrieb am Mittwoch, 18. Dezember 2024 um 00:44:06 UTC+1:
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 10:19AM -0600
> 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.
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|
Colin Alworth <co...@colinalworth.com>: Dec 18 08:25AM -0800
If there was a serialization error, it would be written out using your
servlet container's own logging system - but your own service call could
have had an error too and be written via your
`LogManager.getLogger(getClass()).error(e); `. Can you confirm with your
debugger that the call is being made correctly, and serializing properly?
It might also make sense to deliberately throw an exception (both within
and outside of your try/catch) and see where that log ends up.
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" />
On Wednesday, December 18, 2024 at 10:20:43 AM UTC-6
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 10:55AM -0600
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?
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|
Colin Alworth <co...@colinalworth.com>: Dec 18 09:00AM -0800
That is a very old comment, by a former Googler who didn't follow through
on the various porting things that were proposed.
It also is incorrect, porting gwt-rpc to work with annotation processors is
finished with the "hard parts", and is has been deployed to production for
many years. It isn't perfect for all use cases, but the hard parts weren't
as big of a deal as they were suspected to be.
And, it was wrong as written - final support was added a year and a half
before it was written, see
https://github.com/gwtproject/gwt/commit/580db4248fc38f9721d0a920cabfc2b17e10d73f.
On Wednesday, December 18, 2024 at 10:55:58 AM UTC-6
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 11:04AM -0600
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.
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|
Colin Alworth <co...@colinalworth.com>: Dec 18 09:05AM -0800
Forgot to link the updated project: https://github.com/Vertispan/gwt-rpc/
On Wednesday, December 18, 2024 at 11:00:25 AM UTC-6 Colin Alworth wrote:
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 11:54AM -0600
> 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?
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 12:34PM -0600
> 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?
Thank you,
Neil
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
|