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

Samples java WAR fails to build image using graalvm java8(non-native) #84

Closed
nicolaasg opened this issue Jul 12, 2021 · 1 comment · Fixed by #87
Closed

Samples java WAR fails to build image using graalvm java8(non-native) #84

nicolaasg opened this issue Jul 12, 2021 · 1 comment · Fixed by #87

Comments

@nicolaasg
Copy link

I am using the code from
https://github.com/paketo-buildpacks/samples/tree/main/java/war

Modified pom.xml to set java.version to 8
Ran mvn package to create war file.

Trying to build an image using the following command produces an error:

pack build --verbose --path target/demo-0.0.1-SNAPSHOT.war application/war --env BP_JVM_VERSION=8 --builder paketobuildpacks/builder:base --buildpack gcr.io/paketo-buildpacks/graalvm --buildpack gcr.io/paketo-buildpacks/apache-tomcat


===> BUILDING
Starting build
Running build for buildpack paketo-buildpacks/[email protected]
Looking up buildpack
Finding plan
Running build for buildpack Paketo GraalVM Buildpack 6.2.2
Creating plan directory
Preparing paths
Running build command
Paketo GraalVM Buildpack 6.2.2
https://github.com/paketo-buildpacks/graalvm
Build Configuration:
$BP_JVM_VERSION 8 the Java version
Launch Configuration:
$BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
$BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
$BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
$JAVA_TOOL_OPTIONS the JVM launch flags
No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
GraalVM JDK 8.0.292: Contributing to layer
Downloading from https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java8-linux-amd64-21.1.0.tar.gz
Verifying checksum
Expanding to /layers/paketo-buildpacks_graalvm/jdk
Adding 129 container CA certificates to JVM truststore
unable to invoke layer creator
unable to count JVM classes
unable to walk /layers/paketo-buildpacks_graalvm/jdk
unable to open ZIP /layers/paketo-buildpacks_graalvm/jdk/jre/languages/nfi/builder/svm-none.jar
zip: not a valid zip file
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 145


pack --version
v0.19.0+git-6b588dc

@dmikusa
Copy link
Contributor

dmikusa commented Jul 30, 2021

Sorry for the delayed response. It looks like there is a JAR file that's bundled with GraalVM JDK that isn't valid, at least according to the Go libraries we use.

This is happening when we go through and try to count up all of the class files to estimate metaspace needs. I suspect that we should probably just not fail on this error and just log a warning. It might even be reasonable to have a max errors counter, like 5 or 10, where if you go over that threshold then it errors.

https://github.com/paketo-buildpacks/libjvm/blob/main/count/count_classes.go#L59-L63

Since this is a libjvm issue, I'm going to move this over to that project. Thanks for raising this up!

@dmikusa dmikusa transferred this issue from paketo-buildpacks/graalvm Jul 30, 2021
pivotal-david-osullivan added a commit to pivotal-david-osullivan/libjvm that referenced this issue Aug 12, 2021
…byte JAR files named '*none*' which could not be unzipped during class counting
dmikusa pushed a commit that referenced this issue Aug 12, 2021
pivotal-david-osullivan added a commit that referenced this issue Aug 20, 2021
…med '*none*' which could not be unzipped during class counting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants