Friday, December 20, 2024

Re: Digest for google-web-toolkit@googlegroups.com - 12 updates in 3 topics

> make sure to clear the cache first

Sounds like you haven't setup your caching correctly.  Mine always works perfectly, never have to clear the cache in dev, or when doing a server update.  Here's my Filter:

/**
 * Tell the browser not to cache the .nocache files, by changing the expires time in the HTTP header.
 */
@Component
@Order(1)
public class ServletFilter implements Filter {
private static final String NO_CACHE = ".nocache.js";

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
String requestURI = ((HttpServletRequest)request).getRequestURI();

// Don't cache the nocache
if (requestURI.endsWith(NO_CACHE)) {
setNoCache((HttpServletResponse)response);
}

// Request HTTPS
((HttpServletResponse)response).setHeader("Strict-Transport-Security", "max-age=31536000; includeSubDomains");

chain.doFilter(request, response);
}

private void setNoCache(HttpServletResponse httpResponse) {
long currentTime = new Date().getTime();
httpResponse.setDateHeader("Last-Modified", currentTime);
httpResponse.setDateHeader("Expires", currentTime - 86400000L);
httpResponse.setHeader("Pragma", "no-cache");
httpResponse.setHeader("Cache-Control", "no-store");
}
}

On Friday, 20 December 2024 at 4:40:22 pm UTC+11 Leon wrote:
One thing that is also quite relevant when developing a GWT application is to realize that all GWT generated code lives in the browser and that browser caching can be a problem. Whenever you do a GWT compile and want to check the result in the browser, make sure to clear the cache first because the old code will very likely not be reloaded.
I always have the developer mode in the browser open when developing and never click reload, but always 'empty cache and hard reload'. You will need it a lot.
The same goes for server updates. Best to do them late in the day or early in the morning, so users can't have stale code in their browsers. 
Either that, or learn them to do the hard reload (but you can also try and learn dogs to fly, that might have the same level of success).

Neil, I think you are trying to learn GWT in the hardest way possible. 
GWT is a way to develop a UI using java, but it is not run as java, and at runtime will not have the same possibilities as java. 
So it has its limitations when compared to what you can do with java on the server.
When you've developed something for standard java to work, based on all available libraries and known server possibilities, which you want to port to GWT is like trying to port a sportscar into a tractor. It's not impossible, but it is quite the challenge.

On Thu, Dec 19, 2024 at 9:56 PM <google-we...@googlegroups.com> wrote:
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 10:45PM -0600

I am getting this error on the server:
Type 'com.propfinancing.puzzle.slitherlink.Line' was not included in the
set of types which can be
serialized by this SerializationPolicy or its Class object could not be
loaded. For security purposes,
this type will not be serialized.: instance = Line 0
 
And looking in the .gwt.rpc file, it is not listed there.
 
Interestingly, I see this:
com.propfinancing.puzzle.slitherlink.Line$STATUS
which is an Enum in that class so the GWT compiler obviously processed the
class.
 
I did not get any warnings or error messages from the GWT compiler as to
why it
decided it did not like the class so now I have to guess what it did not
like.
 
Is there a way to improve the messaging to the user to help understand
what happened?
 
Thank you,
Neil
 
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
Craig Mitchell <ma...@craig-mitchell.com>: Dec 18 11:08PM -0800

At a guess, the inner enum needs to be told it can be serialised. Ie:
 
import com.google.gwt.user.client.rpc.IsSerializable;
 
enum STATUS implements IsSerializable { ... }
 
On Thursday, 19 December 2024 at 3:46:31 pm UTC+11 Neil Aggarwal wrote:
 
Colin Alworth <co...@colinalworth.com>: Dec 19 06:19AM -0800

Enums never need to be marked as serializable - unlike records, the Enum
type itself is always serializable, and GWT-RPC assumes the same. From
https://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
 
A type is serializable and can be used in a service interface if one of the
following is true:
...
* The type is an enumeration. Enumeration constants are serialized as a
name only; none of the field values are serialized.
 
 
That error message is indeed what is used when the standard serialization
policy is read from disk, so you've resolved that earlier issue. Can you
confirm that the policy file does include Line (that is, it is correctly
reachable from the remote service instance)? If not, the GWT-RPC generator
(run when the compiler is invoked) might not have seen a clear path to how
this type could be used. Common reasons for that include declaring a field
as being of type Object, which in your head means that any type could be
assigned, but GWT-RPC doesn't want to mark every possibly class as
potentially serializable (both for security reasons and to avoid generating
serialization code for your client for every possible type).
 
On Thursday, December 19, 2024 at 1:08:53 AM UTC-6 ma...@craig-mitchell.com
wrote:
 
Neil Aggarwal <ne...@propfinancing.com>: Dec 19 10:11AM -0600

> Enumeration constants are serialized as a name only; none of the field
values are serialized.
 
 
 
What are the consequences of not having the values?
 
Reading on the Internet, it means I can't use valueOf() and ordinal().
 
But, does it work normally otherwise?
 
Can I assign a constant value to a field, read that value, and compare the
value to one of the
constants?
 
 
 
> Can you confirm that the policy file does include Line
 
 
 
It does not have Line in it:
 
 
 
@FinalFields, true
 
*com*._3dmathpuzzles.play.client.GetPuzzleService, false, false, false,
false, _, 4203465842
 
*com*._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle, true,
true, false, false,
*com*._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle/2547295082,
2547295082
 
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true,
true, true, true,
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533,
3936916533
 
com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false,
com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298
 
com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true,
com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109
 
com.propfinancing.puzzle.Puzzle, true, false, false, false,
com.propfinancing.puzzle.Puzzle/1723715424, 1723715424
 
com.propfinancing.puzzle.slitherlink.Box, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Box/1302152982, 1302152982
 
com.propfinancing.puzzle.slitherlink.Box$STATE, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Box$STATE/1639054469, 1639054469
 
com.propfinancing.puzzle.slitherlink.BoxWithDiagonals, true, true, false,
false, com.propfinancing.puzzle.slitherlink.BoxWithDiagonals/2774485663,
2774485663
 
com.propfinancing.puzzle.slitherlink.Component, true, false, false, false,
com.propfinancing.puzzle.slitherlink.Component/4011233562, 4011233562
 
com.propfinancing.puzzle.slitherlink.Line$STATUS, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Line$STATUS/1640439993, 1640439993
 
com.propfinancing.puzzle.slitherlink.NumberedBox, true, true, false, false,
com.propfinancing.puzzle.slitherlink.NumberedBox/1782628205, 1782628205
 
com.propfinancing.puzzle.slitherlink.Puzzle, true, false, false, false,
com.propfinancing.puzzle.slitherlink.Puzzle/2584703185, 2584703185
 
com.propfinancing.puzzle.slitherlink.RectangularPuzzle, true, false, false,
false, com.propfinancing.puzzle.slitherlink.RectangularPuzzle/3177548746,
3177548746
 
com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle, true,
false, false, false,
com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle/3793384887,
3793384887
 
java.lang.Exception, true, false, true, false,
java.lang.Exception/1920171873, 1920171873
 
java.lang.RuntimeException, true, false, true, false,
java.lang.RuntimeException/515124647, 515124647
 
java.lang.String, true, true, true, true, java.lang.String/2004016611,
2004016611
 
java.lang.Throwable, true, false, true, false,
java.lang.Throwable/2953622131, 2953622131
 
java.util.ArrayList, true, true, false, false,
java.util.ArrayList/4159755760, 4159755760
 
java.util.HashMap, true, true, false, false, java.util.HashMap/1797211028,
1797211028
 
java.util.LinkedHashMap, true, true, false, false,
java.util.LinkedHashMap/3008245022, 3008245022
 
 
 
> the GWT-RPC generator (run when the compiler is invoked) might not have
seen a clear path to how this type could be used
 
 
 
Unfortunately, it is silent about the reason.
 
I am hoping we can improve it help the developer instead of leaving me to
make guesses.
 
 
 
Thank you,
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
Leon <leon.p...@gmail.com>: Dec 19 07:50AM +0100

Hi Neil,
 
If you hardcode an url in your GWT calls, it will be tied to that specific
url. Local testing will not be possible (outside of hacking your own hosts
file) and if you modify your servername you'll need to update your source
code.
 
The webserver is the perfect place to forward your request to the tomcat
instance.
For apache webserver you can do this with the mod_proxy module. Nginx has
the same with proxy_forward (or something similar, don't know by heart).
 
rg,
 
Leon.
 
Vassilis Virvilis <vas...@gmail.com>: Dec 19 09:15AM +0200

I agree with Leon and I can only add that there is also libapache2-mod-jk
to directly proxy from apache to tomcat. The elevator's pitch is about
speed but I think that is also simpler to understand and setup.
 
 
--
Vassilis Virvilis
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 03:48PM -0600

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.
 
 
 
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 01:57PM -0800

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.
 
Generated policy files ensure that the server and client agree on what can
be serialized. This file is generated into the same directory as your
.nocache.js file, and should be available on the server if running in
production. If running with super dev mode and a separate server, you can
direct the server to download the current policy file from SDM by
specifying system property gwt.codeserver.port with the localhost port to
the SDM server. Be sure to reload the server application or hot reload
classes if they change, so that the server side classes match the client
(and the client's policy file).
 
On Wednesday, December 18, 2024 at 3:48:49 PM UTC-6 ne...@propfinancing.com
wrote:
 
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 04:44PM -0600


> 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 saw a warning about that in the log but not know what it meant.
I am serving the client side files from Apache and the server side files
from Tomcat so they are separate.
 
Where does the server side code expect the .gwt.rpc file to be?
 
Colin Alworth <co...@colinalworth.com>: Dec 18 06:11PM -0800

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.
 
RemoteServiceServlet.getSerializationPolicy is responsible for looking this
up, based on the incoming request, and the expected name of the generated
file (according to the client). If using SDM and a port provided as I
mentioned, this method will defer to getCodeServerPolicyUrl() if no policy
file was found on the server itself. Otherwise, you'll see the warning you
mentioned.

On Wednesday, December 18, 2024 at 4:45:23 PM UTC-6 ne...@propfinancing.com
wrote:
 
Neil Aggarwal <ne...@propfinancing.com>: Dec 18 10:06PM -0600

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.
 
 
 
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 10:21PM -0600

> 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!
 
 
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to google-web-tool...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/7718ca69-c56a-43fa-861a-6c47147c85b9n%40googlegroups.com.

RE: Class not included in the set of types for RPC

[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.3dmathpuzzles:3DMathPuzzlesWeb >-----------------
[INFO] Building 3DMathPuzzlesWeb 2.1.0
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ 3DMathPuzzlesWeb ---
[INFO] Deleting C:\OneDrive\Dev\3DMathPuzzlesWeb\target
[INFO]
[INFO] --- resources:3.3.0:resources (default-resources) @ 3DMathPuzzlesWeb ---
[INFO] Copying 0 resource
[INFO] Copying 52 resources
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ 3DMathPuzzlesWeb ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to C:\OneDrive\Dev\3DMathPuzzlesWeb\target\classes
[INFO]
[INFO] --- gwt:1.1.0:compile (default-cli) @ 3DMathPuzzlesWeb ---
[INFO] Compiling module com._3dmathpuzzles.play.DiagonalSlitherlink
[INFO] Compiling 2 permutations
[INFO] Compiling permutation 0...
[INFO] Compiling permutation 1...
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 12.411s
[INFO] Linking into C:\OneDrive\Dev\3DMathPuzzlesWeb\target\3dmp\DiagonalSlitherlink
[INFO] Link succeeded
[INFO] Linking succeeded -- 0.645s
[INFO]
[INFO] --- war:3.3.2:war (default-cli) @ 3DMathPuzzlesWeb ---
[INFO] Packaging webapp
[INFO] Assembling webapp [3DMathPuzzlesWeb] in [C:\OneDrive\Dev\3DMathPuzzlesWeb\target\3dmp]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\OneDrive\Dev\3DMathPuzzlesWeb\src\main\webapp]
[INFO] Building war: C:\OneDrive\Dev\3DMathPuzzlesWeb\target\3dmp.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.273 s
[INFO] Finished at: 2024-12-20T09:31:15-06:00
[INFO] ------------------------------------------------------------------------

> Are you sure you have no compiler errors, and -failOnError (or -strict) is set?

 

No compiler errors.  I changed Vector3f back to non-serializable and ran the
build.  I am attaching the full output from Maven.

 

I have failOnError in my pom.xml:

                                             <plugin>

                                                            <groupId>net.ltgt.gwt.maven</groupId>

                                                            <artifactId>gwt-maven-plugin</artifactId>

                                                            <version>1.1.0</version>

                                                            <extensions>true</extensions>

                                                            <configuration>

                                                                           <failOnError>true</failOnError>

                                                                           <logLevel>INFO</logLevel>

                                                              <moduleName>com._3dmathpuzzles.play.DiagonalSlitherlink</moduleName>

                                                                           <systemProperties>

                                                                           <gwt.persistentunitcachedir>${project.build.directory}/gwt</gwt.persistentunitcachedir>

                                                                           </systemProperties>

                                                            </configuration>

                                             </plugin>                        

 

> We can't see the code you won't share

 

I am willing to share, but my library is HUGE.  It would not be useful to share it with you
until I pared it down to a test case.  Luckily, it looks like that is not going to be necessary.

 

> this is effectively "black box" testing from our part

 

Understood.  That is why I was trying to pare it down to a test case which would illustrate
what happened in a smaller subset of code.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

RE: Class not included in the set of types for RPC

> What about the Point class? Line and Point are missing in the policy file so I guess

> Point might be the issue (or something that Point references)

 

That was it!

 

Point referenced my own super-source version of Vector3f.

I forgot not mark Vector3f as Serializable.

 

Since it is super-source, it is not valid as-is so I excluded it from my
compile of my library.

 

The GWT compiler did not give me any errors or warnings so I did not

realize to look there.

 

I really think the RPC generator should not be silent here.

Puzzle references Point.  Puzzle was processed and present in the .gwt.rpc file

but Point was not processed.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

Re: Class not included in the set of types for RPC

Are you sure you have no compiler errors, and -failOnError (or -strict) is set?

We can't see the code you won't share, so I can only make up scenarios for what might be wrong, as this is effectively "black box" testing from our part. Here's a scenario:

Your RemoteService type doesn't mention Box or Line directly, but Component
Component has other valid subtypes other than Box
Line doesn't actually compile at this time (or: some field that Line references doesn't compile, preventing it from compiling, etc).
But since there are other valid Component types that the compiler can see, GWT-RPC is satisfied that at least one Component subtype can be serialized.

If you remove Line from Box, suddenly Box can itself be compiled, so it can be serialized.

The same above can be true for "serialized" instead of "compiled" - if Line isn't actually able to be compiled and you didn't accurately share Line - for example, is Point serializable? I dont see it on the policy file examples either... do the other non-serializable types reference it or Line?

On Thursday, December 19, 2024 at 11:47:08 PM UTC-6 ne...@propfinancing.com wrote:

This is very interesting.  I added Line as a private member to Box:

  /** Testing a line instance */

  private Line line;

 

And an accessor:

  /** Test method for GWT */

  public Line getLine() {

    return line;

  }

 

Now, Box is not generated in the .gwt.rpc file (Box Box$STATE is still there).

 

If I mark those two items with @GwtIncompatible, Box appears again.

 

Thank you,

Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

 

From: Neil Aggarwal <ne...@propfinancing.com>
Sent: Thursday, December 19, 2024 10:45 PM
To: 'google-we...@googlegroups.com' <google-we...@googlegroups.com>
Subject: RE: Class not included in the set of types for RPC

 

> Can you share the full contents of Line and Box? Or at least their class hierarchy and fields - methods are not important.

 

I am attaching pared-down versions of Component, Box, and Line.

I am also attaching the generated .gwt.rpc

 

> Something has definitely changed since your last email - "Line$STATUS" was present before,

> but isn't now. Was that a deliberate change?

 

Yes. I have been paring down my classes to see if I can find out what the GWT Compiler

does not like so no luck so far.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/47545995-bbb7-4a33-8c8b-082433c833e3n%40googlegroups.com.

Re: Class not included in the set of types for RPC

What about the Point class? Line and Point are missing in the policy file so I guess Point might be the issue (or something that Point references)

-- J.

Neil Aggarwal schrieb am Freitag, 20. Dezember 2024 um 06:47:08 UTC+1:

This is very interesting.  I added Line as a private member to Box:

  /** Testing a line instance */

  private Line line;

 

And an accessor:

  /** Test method for GWT */

  public Line getLine() {

    return line;

  }

 

Now, Box is not generated in the .gwt.rpc file (Box Box$STATE is still there).

 

If I mark those two items with @GwtIncompatible, Box appears again.

 

Thank you,

Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

 

From: Neil Aggarwal <ne...@propfinancing.com>
Sent: Thursday, December 19, 2024 10:45 PM
To: 'google-we...@googlegroups.com' <google-we...@googlegroups.com>
Subject: RE: Class not included in the set of types for RPC

 

> Can you share the full contents of Line and Box? Or at least their class hierarchy and fields - methods are not important.

 

I am attaching pared-down versions of Component, Box, and Line.

I am also attaching the generated .gwt.rpc

 

> Something has definitely changed since your last email - "Line$STATUS" was present before,

> but isn't now. Was that a deliberate change?

 

Yes. I have been paring down my classes to see if I can find out what the GWT Compiler

does not like so no luck so far.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/d5332547-da0a-414f-90f9-0a28fda03727n%40googlegroups.com.

Thursday, December 19, 2024

RE: Digest for google-web-toolkit@googlegroups.com - 12 updates in 3 topics

> I think you are trying to learn GWT in the hardest way possible.

 

I am sure that is true, but I have never been one to shy away from

challenges.

 

As I see it, I can:

  1. Continue trying to use my existing Java code with
    its intricate hierarchy and use of external libraries.
  2. Don't use my existing code.  Instead, write a parallel

set of code just for use with GWT.

 

According to the people on this list, #1 should work.  If it will work,

I prefer that solution to avoid having duplicated code (That's one of

the reasons why I am using Java and GWT in the first place).  Of

course, "should" assumes a lot so nothing is guaranteed.

 

Using GwtIncompatible and super-source, I have been able
to get my code through the GWT compiler.  But now, the RPC

generator is giving me trouble.  I am not sure yet what is causing

that. 

 

As I see it, it could be one of:

  1. Due to my lack of knowledge, my code is structured in a way

that violates some GWT requirement.

  1. My code is stressing GWT and I hit some bug in the system.

 

I think it will be useful to know which.  If it is (a), then I will either
need to re-structure my code or stop the current effort and go to
solution #2 above.  If it is (b), fixing that makes GWT better.

 

I am still willing to continue this path if the people on this list
are still willing to help me.  So far, I have received amazing support
and would like to thank everyone for that.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

RE: Class not included in the set of types for RPC

This is very interesting.  I added Line as a private member to Box:

  /** Testing a line instance */

  private Line line;

 

And an accessor:

  /** Test method for GWT */

  public Line getLine() {

    return line;

  }

 

Now, Box is not generated in the .gwt.rpc file (Box Box$STATE is still there).

 

If I mark those two items with @GwtIncompatible, Box appears again.

 

Thank you,

Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

 

From: Neil Aggarwal <neil@propfinancing.com>
Sent: Thursday, December 19, 2024 10:45 PM
To: 'google-web-toolkit@googlegroups.com' <google-web-toolkit@googlegroups.com>
Subject: RE: Class not included in the set of types for RPC

 

> Can you share the full contents of Line and Box? Or at least their class hierarchy and fields - methods are not important.

 

I am attaching pared-down versions of Component, Box, and Line.

I am also attaching the generated .gwt.rpc

 

> Something has definitely changed since your last email - "Line$STATUS" was present before,

> but isn't now. Was that a deliberate change?

 

Yes. I have been paring down my classes to see if I can find out what the GWT Compiler

does not like so no luck so far.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

Re: Digest for google-web-toolkit@googlegroups.com - 12 updates in 3 topics

One thing that is also quite relevant when developing a GWT application is to realize that all GWT generated code lives in the browser and that browser caching can be a problem. Whenever you do a GWT compile and want to check the result in the browser, make sure to clear the cache first because the old code will very likely not be reloaded.
I always have the developer mode in the browser open when developing and never click reload, but always 'empty cache and hard reload'. You will need it a lot.
The same goes for server updates. Best to do them late in the day or early in the morning, so users can't have stale code in their browsers. 
Either that, or learn them to do the hard reload (but you can also try and learn dogs to fly, that might have the same level of success).

Neil, I think you are trying to learn GWT in the hardest way possible. 
GWT is a way to develop a UI using java, but it is not run as java, and at runtime will not have the same possibilities as java. 
So it has its limitations when compared to what you can do with java on the server.
When you've developed something for standard java to work, based on all available libraries and known server possibilities, which you want to port to GWT is like trying to port a sportscar into a tractor. It's not impossible, but it is quite the challenge.

On Thu, Dec 19, 2024 at 9:56 PM <google-web-toolkit@googlegroups.com> wrote:
Neil Aggarwal <neil@propfinancing.com>: Dec 18 10:45PM -0600

I am getting this error on the server:
Type 'com.propfinancing.puzzle.slitherlink.Line' was not included in the
set of types which can be
serialized by this SerializationPolicy or its Class object could not be
loaded. For security purposes,
this type will not be serialized.: instance = Line 0
 
And looking in the .gwt.rpc file, it is not listed there.
 
Interestingly, I see this:
com.propfinancing.puzzle.slitherlink.Line$STATUS
which is an Enum in that class so the GWT compiler obviously processed the
class.
 
I did not get any warnings or error messages from the GWT compiler as to
why it
decided it did not like the class so now I have to guess what it did not
like.
 
Is there a way to improve the messaging to the user to help understand
what happened?
 
Thank you,
Neil
 
--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!
Craig Mitchell <mail@craig-mitchell.com>: Dec 18 11:08PM -0800

At a guess, the inner enum needs to be told it can be serialised. Ie:
 
import com.google.gwt.user.client.rpc.IsSerializable;
 
enum STATUS implements IsSerializable { ... }
 
On Thursday, 19 December 2024 at 3:46:31 pm UTC+11 Neil Aggarwal wrote:
 
Colin Alworth <colin@colinalworth.com>: Dec 19 06:19AM -0800

Enums never need to be marked as serializable - unlike records, the Enum
type itself is always serializable, and GWT-RPC assumes the same. From
https://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
 
A type is serializable and can be used in a service interface if one of the
following is true:
...
* The type is an enumeration. Enumeration constants are serialized as a
name only; none of the field values are serialized.
 
 
That error message is indeed what is used when the standard serialization
policy is read from disk, so you've resolved that earlier issue. Can you
confirm that the policy file does include Line (that is, it is correctly
reachable from the remote service instance)? If not, the GWT-RPC generator
(run when the compiler is invoked) might not have seen a clear path to how
this type could be used. Common reasons for that include declaring a field
as being of type Object, which in your head means that any type could be
assigned, but GWT-RPC doesn't want to mark every possibly class as
potentially serializable (both for security reasons and to avoid generating
serialization code for your client for every possible type).
 
On Thursday, December 19, 2024 at 1:08:53 AM UTC-6 ma...@craig-mitchell.com
wrote:
 
Neil Aggarwal <neil@propfinancing.com>: Dec 19 10:11AM -0600

> Enumeration constants are serialized as a name only; none of the field
values are serialized.
 
 
 
What are the consequences of not having the values?
 
Reading on the Internet, it means I can't use valueOf() and ordinal().
 
But, does it work normally otherwise?
 
Can I assign a constant value to a field, read that value, and compare the
value to one of the
constants?
 
 
 
> Can you confirm that the policy file does include Line
 
 
 
It does not have Line in it:
 
 
 
@FinalFields, true
 
*com*._3dmathpuzzles.play.client.GetPuzzleService, false, false, false,
false, _, 4203465842
 
*com*._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle, true,
true, false, false,
*com*._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle/2547295082,
2547295082
 
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true,
true, true, true,
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533,
3936916533
 
com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false,
com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298
 
com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true,
com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109
 
com.propfinancing.puzzle.Puzzle, true, false, false, false,
com.propfinancing.puzzle.Puzzle/1723715424, 1723715424
 
com.propfinancing.puzzle.slitherlink.Box, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Box/1302152982, 1302152982
 
com.propfinancing.puzzle.slitherlink.Box$STATE, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Box$STATE/1639054469, 1639054469
 
com.propfinancing.puzzle.slitherlink.BoxWithDiagonals, true, true, false,
false, com.propfinancing.puzzle.slitherlink.BoxWithDiagonals/2774485663,
2774485663
 
com.propfinancing.puzzle.slitherlink.Component, true, false, false, false,
com.propfinancing.puzzle.slitherlink.Component/4011233562, 4011233562
 
com.propfinancing.puzzle.slitherlink.Line$STATUS, true, true, false, false,
com.propfinancing.puzzle.slitherlink.Line$STATUS/1640439993, 1640439993
 
com.propfinancing.puzzle.slitherlink.NumberedBox, true, true, false, false,
com.propfinancing.puzzle.slitherlink.NumberedBox/1782628205, 1782628205
 
com.propfinancing.puzzle.slitherlink.Puzzle, true, false, false, false,
com.propfinancing.puzzle.slitherlink.Puzzle/2584703185, 2584703185
 
com.propfinancing.puzzle.slitherlink.RectangularPuzzle, true, false, false,
false, com.propfinancing.puzzle.slitherlink.RectangularPuzzle/3177548746,
3177548746
 
com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle, true,
false, false, false,
com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle/3793384887,
3793384887
 
java.lang.Exception, true, false, true, false,
java.lang.Exception/1920171873, 1920171873
 
java.lang.RuntimeException, true, false, true, false,
java.lang.RuntimeException/515124647, 515124647
 
java.lang.String, true, true, true, true, java.lang.String/2004016611,
2004016611
 
java.lang.Throwable, true, false, true, false,
java.lang.Throwable/2953622131, 2953622131
 
java.util.ArrayList, true, true, false, false,
java.util.ArrayList/4159755760, 4159755760
 
java.util.HashMap, true, true, false, false, java.util.HashMap/1797211028,
1797211028
 
java.util.LinkedHashMap, true, true, false, false,
java.util.LinkedHashMap/3008245022, 3008245022
 
 
 
> the GWT-RPC generator (run when the compiler is invoked) might not have
seen a clear path to how this type could be used
 
 
 
Unfortunately, it is silent about the reason.
 
I am hoping we can improve it help the developer instead of leaving me to
make guesses.
 
 
 
Thank you,
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
Leon <leon.pennings@gmail.com>: Dec 19 07:50AM +0100

Hi Neil,
 
If you hardcode an url in your GWT calls, it will be tied to that specific
url. Local testing will not be possible (outside of hacking your own hosts
file) and if you modify your servername you'll need to update your source
code.
 
The webserver is the perfect place to forward your request to the tomcat
instance.
For apache webserver you can do this with the mod_proxy module. Nginx has
the same with proxy_forward (or something similar, don't know by heart).
 
rg,
 
Leon.
 
Vassilis Virvilis <vasvir2@gmail.com>: Dec 19 09:15AM +0200

I agree with Leon and I can only add that there is also libapache2-mod-jk
to directly proxy from apache to tomcat. The elevator's pitch is about
speed but I think that is also simpler to understand and setup.
 
 
--
Vassilis Virvilis
Neil Aggarwal <neil@propfinancing.com>: Dec 18 03:48PM -0600

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.
 
 
 
Thank you,
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
Colin Alworth <colin@colinalworth.com>: Dec 18 01:57PM -0800

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.
 
Generated policy files ensure that the server and client agree on what can
be serialized. This file is generated into the same directory as your
.nocache.js file, and should be available on the server if running in
production. If running with super dev mode and a separate server, you can
direct the server to download the current policy file from SDM by
specifying system property gwt.codeserver.port with the localhost port to
the SDM server. Be sure to reload the server application or hot reload
classes if they change, so that the server side classes match the client
(and the client's policy file).
 
On Wednesday, December 18, 2024 at 3:48:49 PM UTC-6 ne...@propfinancing.com
wrote:
 
Neil Aggarwal <neil@propfinancing.com>: Dec 18 04:44PM -0600


> 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 saw a warning about that in the log but not know what it meant.
I am serving the client side files from Apache and the server side files
from Tomcat so they are separate.
 
Where does the server side code expect the .gwt.rpc file to be?
 
Colin Alworth <colin@colinalworth.com>: Dec 18 06:11PM -0800

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.
 
RemoteServiceServlet.getSerializationPolicy is responsible for looking this
up, based on the incoming request, and the expected name of the generated
file (according to the client). If using SDM and a port provided as I
mentioned, this method will defer to getCodeServerPolicyUrl() if no policy
file was found on the server itself. Otherwise, you'll see the warning you
mentioned.

On Wednesday, December 18, 2024 at 4:45:23 PM UTC-6 ne...@propfinancing.com
wrote:
 
Neil Aggarwal <neil@propfinancing.com>: Dec 18 10:06PM -0600

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.
 
 
 
Thank you,
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
Neil Aggarwal <neil@propfinancing.com>: Dec 18 10:21PM -0600

> 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!
 
 
 
Neil
 
 
 
--
 
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
 
We offer 30 year loans on single family houses!
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to google-web-toolkit+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CABjQu7QLNx%2Bd%3DBkxz2BKkAvdcnq0LVAZ7%2BAM-L2WbaTESKysfw%40mail.gmail.com.

RE: Class not included in the set of types for RPC

> Can you share the full contents of Line and Box? Or at least their class hierarchy and fields - methods are not important.

 

I am attaching pared-down versions of Component, Box, and Line.

I am also attaching the generated .gwt.rpc

 

> Something has definitely changed since your last email - "Line$STATUS" was present before,

> but isn't now. Was that a deliberate change?

 

Yes. I have been paring down my classes to see if I can find out what the GWT Compiler

does not like so no luck so far.

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

Re: Class not included in the set of types for RPC

> Enums never need to be marked as serializable

Apologies for my suggestion.  I'm not sure why I thought this.  I removed the IsSerializable from my enums that I transfer, and yep, they still work perfectly.

On Friday, 20 December 2024 at 12:35:19 pm UTC+11 Colin Alworth wrote:
Can you share the full contents of Line and Box? Or at least their class hierarchy and fields - methods are not important.

Only fields (and inheritance) are considered for RPC serialization - a method that returns a new instance won't cause that instance to be serialized (since it isn't part of the object's state).

Something has definitely changed since your last email - "Line$STATUS" was present before, but isn't now. Was that a deliberate change?

On Thursday, December 19, 2024 at 4:43:59 PM UTC-6 ne...@propfinancing.com wrote:

> The consequence is that your enums should never ever have changing data stored

 

Got it.  I never modify the enum via code.  That would be a bit strange.

 

> Maybe Line isn't the only class that is missing in the policy file?

 

Yes, there are others which are missing.

 

> As a workaround you can always add dummy methods to your GWT-RPC service, e.g.

> Line getDummyLine(), to make a class visible to GWT

 

I added this method to com.propfinancing.puzzle.slitherlink.Box:

  public Line gwtGetLine() {

    return new Line();

  }

 

And the generated .gwt.rpc has Box, but still does not have Line:

 

@FinalFields, true

com._3dmathpuzzles.play.client.GetPuzzleService, false, false, false, false, _, 4203465842

com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle, true, true, false, false, com._3dmathpuzzles.slitherlink.RectangularWithDiagonalsPuzzle/2547295082, 2547295082

com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533

com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false, com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298

com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true, com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109

com.propfinancing.puzzle.Puzzle, true, false, false, false, com.propfinancing.puzzle.Puzzle/1723715424, 1723715424

com.propfinancing.puzzle.slitherlink.Box, true, true, false, false, com.propfinancing.puzzle.slitherlink.Box/1302152982, 1302152982

com.propfinancing.puzzle.slitherlink.Box$STATE, true, true, false, false, com.propfinancing.puzzle.slitherlink.Box$STATE/1639054469, 1639054469

com.propfinancing.puzzle.slitherlink.BoxWithDiagonals, true, true, false, false, com.propfinancing.puzzle.slitherlink.BoxWithDiagonals/2774485663, 2774485663

com.propfinancing.puzzle.slitherlink.Component, true, false, false, false, com.propfinancing.puzzle.slitherlink.Component/4011233562, 4011233562

com.propfinancing.puzzle.slitherlink.NumberedBox, true, true, false, false, com.propfinancing.puzzle.slitherlink.NumberedBox/1782628205, 1782628205

com.propfinancing.puzzle.slitherlink.Puzzle, true, false, false, false, com.propfinancing.puzzle.slitherlink.Puzzle/2584703185, 2584703185

com.propfinancing.puzzle.slitherlink.RectangularPuzzle, true, false, false, false, com.propfinancing.puzzle.slitherlink.RectangularPuzzle/3177548746, 3177548746

com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle, true, false, false, false, com.propfinancing.puzzle.slitherlink.RectangularWithDiagonalsPuzzle/3793384887, 3793384887

java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873

java.lang.RuntimeException, true, false, true, false, java.lang.RuntimeException/515124647, 515124647

java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611

java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131

java.util.ArrayList, true, true, false, false, java.util.ArrayList/4159755760, 4159755760

java.util.HashMap, true, true, false, false, java.util.HashMap/1797211028, 1797211028

java.util.LinkedHashMap, true, true, false, false, java.util.LinkedHashMap/3008245022, 3008245022

 

 

Thank you,

 Neil

 

--

Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com

We offer 30 year loans on single family houses!

 

From: google-we...@googlegroups.com <google-we...@googlegroups.com> On Behalf Of Jens
Sent: Thursday, December 19, 2024 3:41 PM
To: GWT Users <google-we...@googlegroups.com>
Subject: Re: Class not included in the set of types for RPC

 

 

Neil Aggarwal schrieb am Donnerstag, 19. Dezember 2024 um 17:12:06 UTC+1:

> Enumeration constants are serialized as a name only; none of the field values are serialized.

What are the consequences of not having the values?

The consequence is that your enums should never ever have changing data stored. For example MyEnum.PERSON.getFriends().add(friend) is possible in Java but makes the enum constant mutable, which is bad. If enum constants are immutable then serializing the name or ordinal is enough to reconstruct the state.

 

> Can you confirm that the policy file does include Line

It does not have Line in it:

Does Line satisfy all rules? Default constructor, implements Serializable and only has Serializable fields? If yes, take a look at your GWT-RPC service method(s) declaration. Starting from the return type and the parameter types of the GWT-RPC method(s), will Line be discoverable directly or is it hidden behind some interface or super class or possibly class Object and GWT would need to find all the candidates that match these interfaces/super classes? If Line is hidden, do the interface / super class follow the rules? Maybe Line isn't the only class that is missing in the policy file?

 

As a workaround you can always add dummy methods to your GWT-RPC service, e.g. Line getDummyLine(), to make a class visible to GWT (or a Dummy class with a Line field and then use Dummy as return type).

 

-- J.

 

 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/d7ee6beb-815d-44ab-8a3f-c292ee198e27n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/32f6f033-3447-44e4-a889-906bac32ad19n%40googlegroups.com.