I am getting an error when deploying a server that is using spring boot. The logic works locally, but I get a 500 error when I deploy to gCloud using App Engine. I am on MacOS.
Any ideas what is misconfigured here? Thank you!
The error looks like this:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/modernmail/ModernMailApplication 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
From searching around, it seems that the root cause is that I'm compiling with a version that isn't supported with app engine (if I understand correctly, 55.0 = java 11 and 61.0 = java 17). I do think app engine supports java 11 now from: https://cloud.google.com/appengine/docs/standard/java-gen2/runtime.
I'm trying to configure my app and environment to use java11 but something must be misconfigured somewhere?
In my appengine/app.yaml:
env: standard
service: server
runtime: java11
In my pom.xml:
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>
The output of my java version command is:
➜ ~ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u)
OpenJDK 64-Bit Server VM OpenLogic-OpenJDK (build 11.0.17+8-adhoc.admin.jdk11u, mixed mode)
And my JAVA_HOME matches:
~ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/openlogic-openjdk-11.jre/Contents/Home
I'm deploying the server using:
./mvnw -DskipTests package appengine:deploy
I'm not exactly clear how to apply the solution from a question like this because java 11 doesn't have a separation between JDK and JRE anymore? My JDK is using java 11, but I'm not sure how check JRE for java11.