Issues upgrading Google services to Java 17

We are  having issues upgrading Google services to Java 17.  I followed the instructions to upgrade app engine apis from version 8 to version 17. The backend build is successful , but I get this error during gcloud deployment :
gcloud app --quiet deploy appengine-web.xml --version=22 --no-promote --verbosity=debug --verbosity=warning
ERROR: (gcloud.app.deploy) Staging command [/usr/bin/java -classpath /usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar com.google.appengine.tools.admin.AppCfg --enable_new_staging_defaults stage /opt/tmp/tmp9r8_i8t1/tmpkxfacysd] failed with return code [1]
 
java.lang.UnsupportedClassVersionError:  /HeartbeatServlet
has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
My image is in java 17 , so HeartbeatServlet has been compiled on version 17.
Has anyone seen this issue before ?
 
0 2 465
2 REPLIES 2

Hi @encarna,

Welcome to Google Cloud Community!

You're upgrading Google services to Java 17, but deployment fails due to a mismatch between HeartbeatServlet's Java 17 class version and App Engine's Java 11 expectation. Here are your options:

  • Recompile HeartbeatServlet for Java 11: Use your build system's source/target settings to target Java 11 for this specific class.
  • Adjust App Engine environment: Temporarily edit appengine-web.xml to allow Java 17 class files (not recommended for security).
  • Consider App Engine Flexible: Deploy in a custom Java 17 environment for full control, but manage your own runtime instances.

Remember to check other dependencies and consult the Java 17 documentation for details. Choose the solution that best suits your security needs and project requirements.

Hi @christianpaula ,

Thanks for the answer. Regarding the suggested options :

Recompile HeartbeatServlet for Java 11--> we reverted to this option for now 

Adjust App Engine environment --> this option also throws the error I mentioned in the ticket 

Consider App Engine Flexible: Deploy in a custom Java 17 environment for full control, but manage your own runtime instances-- > Is this a new service that Google provides?

Thanks & regards

Encarna