Wednesday, December 11, 2024

Re: Overriding ServletContainerLauncher not sufficient for Servlet 5.0/Jakarta migration of DevMode



On Wednesday, December 11, 2024 at 8:05:10 PM UTC+1 Fred Andrews wrote:
Sadly, GWT 2.12.1 still contains bundled Jetty 9, which is incompatible with Servlet 5.0.  Upon looking into it, I see that the suggestion is to override ServletContainerLauncher with my own implementation that launches Jetty 11+.

The suggestion is to run them (server vs client code) in separate processes.
 
I'm running GWT DevMode from an ant environment, so I updated the ant task to have the proper JARs for Jetty 11, overrode ServletContainerLauncher, and tried to launch DevMode.  However, although DevMode does launch Jetty 11, the CodeServer crashes because of its dependence on javax - looking at the source I see that it has hardcoded javax imports.

You could probably implement a ServletContainerLauncher based on something else than Jetty though (Tomcat, Undertow)
 
So is it impossible to use the built-in CodeServer when you override ServletContainerLauncher?  What's the point of DevMode without CodeServer?

I see lots of suggestions to launch CodeServer separately, but even this may still have a problem.  ChatGPT says that some shared client/server code may contain servlet class references, which means that CodeServer might be faces with compiling jakarta imports.  This is going to fail obviously.  So what's the guidance here?  Is CodeServer dead too?  Or is there a Jakarta-based CodeServer in GWT 2.12.1 too?

The only cases of shared code referencing server code should be either GWT.create(MyRpcService.class), but even those shouldn't problems: because there's a change in package you can have javax.servlet and jakarta.servlet API JARs in the same classpath.
(there's also the case of RequestFactory's @ProxyFor/@Service but those generally won't reference servlet classes; and you could change to @ProxyForName/@ServiceName to cut the reference)

What you cannot do is have "conflicting" Jetty versions, because CodeServer directly uses Jetty and relies on its API, that changes with almost every release.

Using distinct classpaths/processes is your best bet in the long run, even if that possibly mean making some (small) changes to your code.

--
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/e1d27989-fa11-4e41-b069-c26bc1b860d7n%40googlegroups.com.

No comments:

Post a Comment