Thursday, January 9, 2025

Re: GWT Dev Conflict with Spring Boot 3.4 and Google GSON

Hi Colin,

> That said... you should not have gwt-dev on the same classpath as your server.

Unfortunately in my case I could not avoid it.
I use com.google.gwt.user.server.rpc.XsrfTokenServiceServlet (from gwt-user) and it refers com.google.gwt.util.tools.shared.Md5Utils from gwt-dev (GWT 2.12.1)
So I have to keep gwt-dev in classpath
There's another class I need, com.google.gwt.core.client.UnsafeNativeLong also in gwt-dev, but it can be factored out so it's not that critical. It's just useless to do that while XsrfTokenServiceServlet  still needs gwt-dev

On Thursday, January 9, 2025 at 3:36:33 AM UTC+1 Colin Alworth wrote:
Update the GSON version as you're doing - Ahmad is in the process of making this change in GWT itself:

In the next GWT release, we'll default to using 2.11.0.

That said... you should not have gwt-dev on the same classpath as your server, and you should not remove gson from gwt-dev, or you may have compilation issues with sourcemaps.

The tweak you're making is totally acceptable to make to gwt-servlet (or gwt-servlet-jakarta) though - either exclude if you don't use the stack trace deobfuscator with sourcemaps, or just update to 2.11.0.

On Wednesday, January 8, 2025 at 8:28:39 PM UTC-6 ma...@craig-mitchell.com wrote:
When upgrading from Spring Boot 3.3 to 3.4, my app still compiles, but when I run it, crashes with:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2025-01-09 12:36:47.028] - 13568 SEVERE [restartedMain] --- org.springframework.boot.SpringApplication: Application run failed
java.lang.NoClassDefFoundError: com/google/gson/Strictness

Others have reported the same issue, but with different causes:  https://github.com/spring-projects/spring-boot/issues/43442

When I look at who is using GSON, it's gwt-dev.jar:

[INFO] teamdrift:drift-team-client:gwt-app:1.0-SNAPSHOT
[INFO] +- org.gwtproject:gwt-dev:jar:2.12.1:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.6.2:compile

I can fix it by adding the newer version to my server:
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.11.0</version>
</dependency>

And optionally, to clean up so the old version, remove it from my client gwt-dev:
<dependency>
  <groupId>org.gwtproject</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Is this the best fix?  Or is there something better?

Thanks.

--
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/a7c70749-6a87-4ad8-8f54-d94fbe4a2a5en%40googlegroups.com.

Wednesday, January 8, 2025

Re: GWT Dev Conflict with Spring Boot 3.4 and Google GSON

Awesome!  Thanks Colin and Ahmad!

> That said... you should not have gwt-dev on the same classpath as your server, and you should not remove gson from gwt-dev, or you may have compilation issues with sourcemaps.

Apologies, it isn't.  I was incorrect when I sait it could be removed.  I removed it, started the code server, and everything looked good.  It wasn't until after I posted my message, I realised the code server couldn't compile the JS without it.

> The tweak you're making is totally acceptable to make to gwt-servlet (or gwt-servlet-jakarta) though - either exclude if you don't use the stack trace deobfuscator with sourcemaps, or just update to 2.11.0.

Excellent.  Thanks again.  :)

On Thursday, 9 January 2025 at 1:36:33 pm UTC+11 Colin Alworth wrote:
Update the GSON version as you're doing - Ahmad is in the process of making this change in GWT itself:

In the next GWT release, we'll default to using 2.11.0.

That said... you should not have gwt-dev on the same classpath as your server, and you should not remove gson from gwt-dev, or you may have compilation issues with sourcemaps.

The tweak you're making is totally acceptable to make to gwt-servlet (or gwt-servlet-jakarta) though - either exclude if you don't use the stack trace deobfuscator with sourcemaps, or just update to 2.11.0.

On Wednesday, January 8, 2025 at 8:28:39 PM UTC-6 ma...@craig-mitchell.com wrote:
When upgrading from Spring Boot 3.3 to 3.4, my app still compiles, but when I run it, crashes with:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2025-01-09 12:36:47.028] - 13568 SEVERE [restartedMain] --- org.springframework.boot.SpringApplication: Application run failed
java.lang.NoClassDefFoundError: com/google/gson/Strictness

Others have reported the same issue, but with different causes:  https://github.com/spring-projects/spring-boot/issues/43442

When I look at who is using GSON, it's gwt-dev.jar:

[INFO] teamdrift:drift-team-client:gwt-app:1.0-SNAPSHOT
[INFO] +- org.gwtproject:gwt-dev:jar:2.12.1:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.6.2:compile

I can fix it by adding the newer version to my server:
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.11.0</version>
</dependency>

And optionally, to clean up so the old version, remove it from my client gwt-dev:
<dependency>
  <groupId>org.gwtproject</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Is this the best fix?  Or is there something better?

Thanks.

--
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/e6ae0710-925a-456b-9d75-9c6ea6507734n%40googlegroups.com.

Re: GWT Dev Conflict with Spring Boot 3.4 and Google GSON

Update the GSON version as you're doing - Ahmad is in the process of making this change in GWT itself:
https://github.com/gwtproject/gwt/pull/10079
https://github.com/gwtproject/tools/pull/34

In the next GWT release, we'll default to using 2.11.0.

That said... you should not have gwt-dev on the same classpath as your server, and you should not remove gson from gwt-dev, or you may have compilation issues with sourcemaps.

The tweak you're making is totally acceptable to make to gwt-servlet (or gwt-servlet-jakarta) though - either exclude if you don't use the stack trace deobfuscator with sourcemaps, or just update to 2.11.0.

On Wednesday, January 8, 2025 at 8:28:39 PM UTC-6 ma...@craig-mitchell.com wrote:
When upgrading from Spring Boot 3.3 to 3.4, my app still compiles, but when I run it, crashes with:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2025-01-09 12:36:47.028] - 13568 SEVERE [restartedMain] --- org.springframework.boot.SpringApplication: Application run failed
java.lang.NoClassDefFoundError: com/google/gson/Strictness

Others have reported the same issue, but with different causes:  https://github.com/spring-projects/spring-boot/issues/43442

When I look at who is using GSON, it's gwt-dev.jar:

[INFO] teamdrift:drift-team-client:gwt-app:1.0-SNAPSHOT
[INFO] +- org.gwtproject:gwt-dev:jar:2.12.1:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.6.2:compile

I can fix it by adding the newer version to my server:
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.11.0</version>
</dependency>

And optionally, to clean up so the old version, remove it from my client gwt-dev:
<dependency>
  <groupId>org.gwtproject</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Is this the best fix?  Or is there something better?

Thanks.

--
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/136e7fbd-d18d-41d4-9af0-29693e085ee6n%40googlegroups.com.

Re: GWT Dev Conflict with Spring Boot 3.4 and Google GSON

Woops, spoke a little too soon.  It's not possible to clean up and remove it from gwt-dev, as the code server needs it.

So, I need 2 versions of Google GSON.  2.6.2 for GWT, and 2.11.0 for Spring Boot.

On Thursday, 9 January 2025 at 1:28:39 pm UTC+11 Craig Mitchell wrote:
When upgrading from Spring Boot 3.3 to 3.4, my app still compiles, but when I run it, crashes with:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2025-01-09 12:36:47.028] - 13568 SEVERE [restartedMain] --- org.springframework.boot.SpringApplication: Application run failed
java.lang.NoClassDefFoundError: com/google/gson/Strictness

Others have reported the same issue, but with different causes:  https://github.com/spring-projects/spring-boot/issues/43442

When I look at who is using GSON, it's gwt-dev.jar:

[INFO] teamdrift:drift-team-client:gwt-app:1.0-SNAPSHOT
[INFO] +- org.gwtproject:gwt-dev:jar:2.12.1:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.6.2:compile

I can fix it by adding the newer version to my server:
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.11.0</version>
</dependency>

And optionally, to clean up so the old version, remove it from my client gwt-dev:
<dependency>
  <groupId>org.gwtproject</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Is this the best fix?  Or is there something better?

Thanks.

--
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/dc7c3bcf-dfee-458b-9550-bbf58976f7b4n%40googlegroups.com.

GWT Dev Conflict with Spring Boot 3.4 and Google GSON

When upgrading from Spring Boot 3.3 to 3.4, my app still compiles, but when I run it, crashes with:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
[2025-01-09 12:36:47.028] - 13568 SEVERE [restartedMain] --- org.springframework.boot.SpringApplication: Application run failed
java.lang.NoClassDefFoundError: com/google/gson/Strictness

Others have reported the same issue, but with different causes:  https://github.com/spring-projects/spring-boot/issues/43442

When I look at who is using GSON, it's gwt-dev.jar:

[INFO] teamdrift:drift-team-client:gwt-app:1.0-SNAPSHOT
[INFO] +- org.gwtproject:gwt-dev:jar:2.12.1:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.6.2:compile

I can fix it by adding the newer version to my server:
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.11.0</version>
</dependency>

And optionally, to clean up so the old version, remove it from my client gwt-dev:
<dependency>
  <groupId>org.gwtproject</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Is this the best fix?  Or is there something better?

Thanks.

--
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/a33d18bc-728f-4d4c-9153-db7772ee1394n%40googlegroups.com.

Tuesday, January 7, 2025

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

Thanks - I knew that Maven was explicitly opt-in, but several Gradle projects I've worked on have hit this issue so I assumed it was a facet of Gradle itself. Turns out instead, a single plugin shared among these projects, only referenced indirectly, was traversing the tasks of all projects and applying this. I guess you can draw an analogy to a maven parent pom doing configuration you didn't expect, except any plugin with access to the Project instance could technically have done this.

I also excluded Bazel, as the few developers who use it beyond trivial examples already will need to deeply understand its internals, and so would already expect this.

On Tuesday, January 7, 2025 at 3:52:48 AM UTC-6 Thomas Broyer wrote:
On Monday, January 6, 2025 at 4:46:51 PM UTC+1 Colin Alworth wrote:
Take a little care with testing/validating etag though - stock Jetty at least does not hash the file to produce this (to avoid the expense of reading the entire file to produce the hash, then re-reading it from start to stream it), but uses the file modification date assuming is a valid proxy for changes.

 
Thwarting this, gradle helpfully sets file metadata in a jar/war to a point decades in the past, regardless of actual values, to ensure its own caching isn't impacted by files being refreshed.

Gradle doesn't do that by default, this is part of an explicit configuration to get reproducible builds: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:preserveFileTimestamps
You'd have the same issues with Bazel (does reproducible builds by default) or Maven (https://maven.apache.org/guides/mini/guide-reproducible-builds.html)

--
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/b1fb0d17-b8cf-4b46-b9e0-aa50f057d078n%40googlegroups.com.

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



On Monday, January 6, 2025 at 4:46:51 PM UTC+1 Colin Alworth wrote:
Take a little care with testing/validating etag though - stock Jetty at least does not hash the file to produce this (to avoid the expense of reading the entire file to produce the hash, then re-reading it from start to stream it), but uses the file modification date assuming is a valid proxy for changes.

Apache HTTPD (https://httpd.apache.org/docs/2.4/mod/core.html#fileetag) and Nginx (https://github.com/nginx/nginx/blob/e3a9b6ad08a86e799a3d77da3f2fc507d3c9699e/src/http/ngx_http_core_module.c#L1701-L1704) do something similar
 
Thwarting this, gradle helpfully sets file metadata in a jar/war to a point decades in the past, regardless of actual values, to ensure its own caching isn't impacted by files being refreshed.

Gradle doesn't do that by default, this is part of an explicit configuration to get reproducible builds: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:preserveFileTimestamps
You'd have the same issues with Bazel (does reproducible builds by default) or Maven (https://maven.apache.org/guides/mini/guide-reproducible-builds.html)

--
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/66ce266f-b68c-4471-955e-9f8949063200n%40googlegroups.com.