I'm trying to deploy a spring boot application in Kubernetes hosted by Scaleway. After the deployment, I have the following error :
java.lang.UnsupportedClassVersionError: xx/yy/zz/Application has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 58.0
My pom file has the following properties :
<properties>
<java.version>18</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
In my dockerfile configuration, I use the following config :
FROM --platform=linux/amd64 openjdk:14-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
I tried different versions without solving the problem. Do you have an idea ?
CodePudding user response:
You are compiling your application for a newer JVM than the container image, that is executing the application, provides.
You are also mixing the compiler settings with the old (maven.compiler) and newer (java.version) syntax. Leaving out the "java.version" setting should fix your immediate issue.
CodePudding user response:
The kubernetes configuration lacks the imagePullPolicy: Always property