Migrating to Java 11

This guide outlines a process you can follow to migrate your Google Cloud server code from Java 8 and the standalone App Engine SDK to Java 11 and the Cloud SDK.


This is a companion discussion topic for the original entry at https://happycoding.io/tutorials/google-cloud/migrating-to-java-11

This is really helpful. I have a legacy Java 8 app. I looked at migrating it couple years ago, but put it off as my datastore was not yet migrated to Firestore in Datastore mode. It has been migrated automatically by Google now. The other challenge was that I couldn’t get the logging to work properly.

Can you comment on how you implemented logging for your app?

Thanks!

1 Like

To be honest, for my own personal projects I don’t do much logging.

I know that print statements and other logging info goes to the logging tab in the Cloud console, so my usual approach is a good old fashioned System.out.println() and then to look there.

@Kevin I resolved the logging issue, but I’m facing several other challenges with this migration.

  1. I use Google Cloud Endpoints Framework with my Java 8 runtime app, but it’s not supported for Java 11 runtime. I have not found any information about a replacement.

  2. I have a GuiceServletContextListener to initialize my app. The approach is explained here: Configuring Warmup Requests to Improve Performance (unfortunately, I’m not allowed to share links on this forum). The listener is included in my web.xml. I have GuiceFilter also in the web.xml. So, is the web.xml still used? I don’t see my listener getting invoked. All my endpoints and servlet mappings are done using com.google.inject.servlet.ServletModule which are injected using GuiceServletContextListener.

It seems like I have to abandon this upgrade, and completely ditch GAE. :frowning:

Do you have any suggestions for me?

Thanks!

Honestly I don’t blame you. I was really frustrated when I migrated all my stuff.

None of my examples use web.xml to configure the Jetty web server, but my understanding is that this should still be possible. You might also be able to set up your listeners in your main method that runs the server.