swagger-codegen
swagger-codegen copied to clipboard
Docker images for swagger-codegen-cli-v3 error out on startup due to incompatible JVM version
Description
When the Docker images for swagger-codegen-cli-v3 are run, an error occurs on startup:
$ docker run --rm swaggerapi/swagger-codegen-cli-v3
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Exception in thread "main" java.lang.UnsupportedClassVersionError: ch/qos/logback/classic/spi/LogbackServiceProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.slf4j.LoggerFactory.safelyInstantiate(LoggerFactory.java:148)
at org.slf4j.LoggerFactory.findServiceProviders(LoggerFactory.java:129)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:190)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:182)
at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:490)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:476)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:425)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:451)
at io.swagger.codegen.v3.cli.SwaggerCodegen.<clinit>(SwaggerCodegen.java
I am running the Docker image on a Mac with Apple silicon (M2 Pro).
Swagger-codegen version
This impacts swagger-codegen-cli-v3:3.0.47 and later. 3.0.46 and previous are unaffected.
Swagger declaration file content or url
n/a
Command line used for generation
$ docker run --rm swaggerapi/swagger-codegen-cli-v3:3.0.47
Steps to reproduce
Any invocation of swagger-codegen-cli-v3:3.0.47 and later trigger the issue.
Related issues/PRs
I was unable to find related PRs.
Suggest a fix/enhancement
Change the JVM version used to run swagger-codegen-cli-v3.