Wednesday, June 12, 2024

Re: GWT, Java 17, jakarta.servlet, Eclipse, GWT plugin

1. You do not have to use Jakarta if you want to migrate to Java 17. You can very well stay on javax and first make the JDK transition work
2. GWT's embedded Jetty is always javax because it is version 9.4.xx. The use of GWT's embedded Jetty is officially deprecated and you should use your own Jetty installation (local, docker image, maven/gradle plugin, ...). This is especially true if you want to use Jakarta.
3. GWT 2.11 publishes *-jakarta dependencies that you can use once you start moving to Jakarta.
4. GWT Compiler only supports source level 11 so far

I use Java 11 for GWT client side code and Java 21 + javax for server side code. Needless to say that I have split client, shared and server code into their own projects. This is the recommeneded project layout these days because it gives you dedicated classpaths for each project and the option to use different JDK versions.

-- J.

Bob Lacatena schrieb am Mittwoch, 12. Juni 2024 um 00:01:47 UTC+2:
I am wrestling with a massive effort that has been one stumbling block after another. The core task is to convert a sadly monolithic and archaic app from Java 8 to Java 17.

My current subtask (maybe necessary, maybe not) is to convert everything to use jakarta.servlet rather than javax.servlet, but when I try to declare an import of com.google.gwt.user.server.rpc.jakarta.RemoteServiceServlet, Eclipse just keeps replacing it with the "original" (non-jakarta) path.

I was hoping I could solve this by renaming the gwt-servlet-jakarta.jar file as gwt-servlet.jar, and putting that in war/WEB-INF/lib, but it doesn't change the Eclipse behavior, AND it originally generated an error that the size of that jar did not match the SDK... but after a clean-build that problem (at least) went away.

But my underlying problem is that I have classes that need to extend the RemoteServiceServlet, and access the associated ServletContext, HttpServletRequest, SerializationException and other classes that must all be the jakarta (not javax) versions. 

I can go back to using javax (and I'm not at all certain that the Eclipse embedded Jatty server will use jakarta instead of javax, so maybe jakarta won't work locally anyway)... but then I have to solve a problem where GWT dev mode (with javax) gives me:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module gwt.user not found, required by com.xxxxx.myapp

Or do I have to move into a world where I stop using the so-convenient embedded Jetty and deploy to and run an external server?

Any advice on what to do (or, preferably, a deeper understanding of what is happening) would be greatly appreciated.

--
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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/d97a9520-dab4-4bcd-b63b-e9b86ac0b930n%40googlegroups.com.

No comments:

Post a Comment