I’ve gone through the steps to migrate my Java 8 standard env appengine project to Java 17 (with legacy bundle). When trying to start I get tons of “class X is not a javax.Servlet” or “class X is not a javax.Filter” exceptions. Those classes are present and loaded and javax.Servlet is coming from google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/jetty94/jetty-home/lib/servlet-api-3.1.jar
example…
java.lang.IllegalStateException: class com.stellarcoresoftware.camperschoice.server.NamespaceFilter is not a javax.servlet.Filter
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:103)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:749)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
May I know the version of Jetty that you’re currently using? Based on this documentation on the Eclipse Jetty project, the recommended version is Jetty 12.0.x when using Java 17+ but Jetty 11.0.x and 10.0.x will work as well.
Since the error mentioned that it’s using Servlet 3.1, it’s recommended to install the latest Jetty version which is 12.0.x.
You may also want to check these Stack Overflow questions as references:
It is Jetty 9.4 which I understand needs to be upgraded. I’m not sure how to do that as the Jetty jars are buried deep in the Cloud SDK which I only recently installed. (path in original post). I’m actually following the instructions for migrating from Java 8 to Java 17.
Upon checking some Google App Engine documentation, the latest supported version is still Java 8/Jetty 9 as Java 11 and 17 is still in its preview/infancy stage. You may check the documentations below for your reference:
If you really need this feature, you may want to file a feature request. Please be advised that we don’t have a specific ETA on this one however you can keep track of its updates by following its progress once the ticket has been created.
Seems strange that I am getting notices to migrate off of Java 8 as it’s
going end-of-life but it’s the “latest supported version”. I guess I will
just wait a while.