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

Java 10 support? #550

Closed
aclowkey opened this issue Jul 11, 2018 · 15 comments
Closed

Java 10 support? #550

aclowkey opened this issue Jul 11, 2018 · 15 comments

Comments

@aclowkey
Copy link

Description of the issue:
Running a Java10 compiled, jib built image fails:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: c/z/o/App has been compiled by a more recent version of the Java Runtime (class file version 54.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:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
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 sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

Expected behavior:
App should run?
Steps to reproduce:
Compile with java10
Environment:
Maven

@chanseokoh
Copy link
Member

Jib uses gcr.io/distroless/java as the base image by default, which uses openjdk8. For Java 10, I think you should find a reliable base image with Java 10, and configure Jib to use it (pom.xml).

@coollog
Copy link
Contributor

coollog commented Jul 11, 2018

+1 @chanseokoh

For example, you could try using openjdk:10-jre as your from image.

@aclowkey
Copy link
Author

@coollog I tried that and it failed as unauthorized. Do I need credentials for the public image?
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"library/openjdk","Action":"pull"}]}]}

@coollog
Copy link
Contributor

coollog commented Jul 11, 2018

@aclowkey We are cutting a release of version 0.9.4 soon with a fix for that issue (#549)

@patflynn
Copy link
Contributor

@coollog should we file a FR against distroless/java for more up-to-date java support? Jib should be able to pick the right base-image based off of the maven/gradle java config.

@briandealwis
Copy link
Member

GoogleContainerTools/distroless#214

@briandealwis
Copy link
Member

@briandealwis
Copy link
Member

I suppose we could hard-code a check that if a <from> image isn't specified then we check the maven compiler settings. Or better yet, use the Maven compiler settings to determine the <from> image when not specified.

@coollog
Copy link
Contributor

coollog commented Jul 11, 2018

@aclowkey Can you try again with version 0.9.4?

@aclowkey
Copy link
Author

aclowkey commented Jul 12, 2018

@coollog Works! Image size is 200Mb more tho. Default produces an image size of 77Mb, with JDK10 it comes out as ~270Mb

@coollog
Copy link
Contributor

coollog commented Jul 12, 2018

@aclowkey Yea, openjdk images tend to be larger than distroless. Did you try using openjdk:10-jre-slim? It's a lot smaller than openjdk:10-jre (286MB vs 632MB).

@aclowkey
Copy link
Author

@coollog Much better! ~130Mb

@briandealwis
Copy link
Member

Doesn't really make sense to address this until we have blessed images for other JRE versions.

@coollog
Copy link
Contributor

coollog commented Aug 29, 2018

We will skip Java 10 and add support for detection and use of LTS Java 11 version of gcr.io/distroless/java once it is available.

@chanseokoh
Copy link
Member

Java 11 Distroless is available, and Jib uses it by default for Java 9+ apps. (#1279, #1510).

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

5 participants