Wednesday, June 12, 2024

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

This might help: its a different solution to the issue Craig dealt with.
Its an extension of the gwt multi-module sample with an embedded Jetty,
for Java 11 without Spring.
https://github.com/timmacp/AppEngineGwt/tree/main

On Wednesday, June 12, 2024 at 9:03:01 AM UTC+1 Wejden Mrabti wrote:
hello!
@Craig it looks great what you have done!
@bob I am working on same migration acutally, It looks that the embedded Jetty in GWT DevMode has been deprecated in GWT 2.11 due to classloader issues and other complexities. To avoid these problems, you can try  transition to a dedicated servlet container like Jetty or Tomcat for both development and production. You can deploy your war file using Docker or a Maven plugin. Ensure that your development environment is set up to deploy to this dedicated servlet container instead of using the embedded Jetty. You can check the updated GWT Getting Started Guide  (https://www.gwtproject.org/gettingstarted-v2.html )for detailed instructions on setting up your project and development environment, making the transition from Java 8 to Java 17 smoother.

Le mercredi 12 juin 2024 à 02:27:57 UTC+2, Craig Mitchell a écrit :
I would recommend creating a new project with everything that you want to use, get it working how you like, then use that as a template on how you will upgrade your existing project.

For my project that I needed to upgrade from Java 8 to Java 17 (because Google App Engine dropped support for Java 8).  I decided I would go "all-in" and get it onto the latest of everything.  So I needed to switch to use Maven, switch to use a client/server/shared structure, switch to use my own server (I went with Undertow), and switch to use Jakarta.  I also decided to go with Spring Boot (as Google App Engine had examples for that), so I used https://github.com/NaluKit/gwt-maven-springboot-archetype to create a sample project, and used that as a guide on how to upgrade my existing project.  Oh, and I also switched from Eclipse to IntelliJ.

It was a big job and a lot of work, but now everything is running beautifully, so worth it in the long run.

On Wednesday 12 June 2024 at 8:01:47 am UTC+10 Bob Lacatena wrote:
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/960a7bb5-7443-4e97-94e7-3c8b822f4afan%40googlegroups.com.

No comments:

Post a Comment