Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jkube 1.17.0 for Java 17 image contains Java 21 bytecode for java.util components #3573

Open
robinroos opened this issue Nov 27, 2024 · 2 comments

Comments

@robinroos
Copy link
Contributor

Describe the bug

We use JKube 1.13.1 targeting Java 17 runtime platform deployment to Open Shift.

When we tried to adopt JKube 1.17.0 the build process worked but the base image seemed to carry with it a Java 21 edition of java.util.

Here are the notes I took:

jkube 1.17.0

oc: spring-boot: Using Docker image quay.io/jkube/jkube-java:0.0.24 as base / builder

application runtime:

2024-10-21 16:00:38.876 ERROR o.g.a.w.WeavingClassFileTransformer - error weaving java/util/WeakHashMap$HashIterator: Unsupported class file major version 65
java.lang.IllegalArgumentException: Unsupported class file major version 65

jkube 1.13.1

build log:

oc: spring-boot: Using Docker image quay.io/jkube/jkube-java:0.0.19 as base / builder

application runtime:

No Exceptions.

Eclipse JKube version

1.17.0

Component

OpenShift Maven Plugin

Apache Maven version

3.6.3

Gradle version

None

Steps to reproduce

<properties>
    <version.jkube>1.17.0</version.jkube>
    <maven.compiler.release>17</maven.compiler.release>
    <kubernetes.trust.certificates>true</kubernetes.trust.certificates>
    <jkube.enricher.jkube-service.type>ClusterIP</jkube.enricher.jkube-service.type>
    <jkube.enricher.jkube-service.normalizePort>false</jkube.enricher.jkube-service.normalizePort>
    <jkube.generator.alias>${project.artifactId}</jkube.generator.alias>
    <jkube.rolling>false</jkube.rolling>
    <jkube.enricher.jkube-controller.replicaCount>2</jkube.enricher.jkube-controller.replicaCount>
    <jkube.build.buildOutput.kind>DockerImage</jkube.build.buildOutput.kind>
    <jkube.generator.name>redacted</jkube.generator.name>
    <jkube.build.pushSecret>redacted</jkube.build.pushSecret>
    <jkube.build.switchToDeployment>true</jkube.build.switchToDeployment>
    <jkube.build.strategy>docker</jkube.build.strategy>
</properties>

Expected behavior

Java 17 base image should not contain Java 21 bytecode.

Runtime

OpenShift

Kubernetes API Server version

1.25.3

Environment

Linux

Eclipse JKube Logs

No issue at build time.

Sample Reproducer Project

I will happily work with you on this as required but cannot submit a reproducer project at this time.

Additional context

Works fine wit JKube 1.13.1, fails at runtime with JKube 1.17.0-generated deployment:

2024-10-21 16:00:38.876 ERROR o.g.a.w.WeavingClassFileTransformer - error weaving java/util/WeakHashMap$HashIterator: Unsupported class file major version 65
java.lang.IllegalArgumentException: Unsupported class file major version 65

@robinroos robinroos added the bug Something isn't working label Nov 27, 2024
@manusa
Copy link
Member

manusa commented Nov 27, 2024

Hi Robin,
The 17 in the JKube version has nothing to do with the supported Java version.
We've been supporting Java 21 almost since the LTS version of Java was released.
However, in case your project is not compatible with Java 21, we still maintain a Java 17 image (https://quay.io/repository/jkube/jkube-java-17 / https://github.com/eclipse-jkube/jkube-images/blob/70378958e9aac35963545c52f6c1d3bb192cbefb/jkube-java-17.yaml).

You can switch to use this image just by adding the following property in your Java project:

<jkube.generator.from>quay.io/jkube/jkube-java-17</jkube.generator.from>

That should solve your problem.

Related:

@manusa manusa removed the bug Something isn't working label Nov 27, 2024
@robinroos
Copy link
Contributor Author

Thanks for that.

We chose the alternative approach and I am expediting our adoption of Java 21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants