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

uberjar: second build fails #4858

Closed
rvansa opened this issue Oct 25, 2019 · 5 comments · Fixed by #4865
Assignees
Milestone

Comments

@rvansa
Copy link
Contributor

@rvansa rvansa commented Oct 25, 2019

Describe the bug
With uberjar enabled, the second time I run mvn install it fails with:

[ERROR]     [error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildUberJar threw an exception: java.lang.IllegalStateException: java.nio.file.FileAlreadyExistsException: META-INF/services/org.eclipse.microprofile.context.spi.ContextManagerProvider
[ERROR]     at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:949)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR]     at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR]     at java.lang.Thread.run(Thread.java:748)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.nio.file.FileAlreadyExistsException: META-INF/services/org.eclipse.microprofile.context.spi.ContextManagerProvider
[ERROR]     at com.sun.nio.zipfs.ZipFileSystem.newOutputStream(ZipFileSystem.java:516)
[ERROR]     at com.sun.nio.zipfs.ZipPath.newOutputStream(ZipPath.java:790)
[ERROR]     at com.sun.nio.zipfs.ZipFileSystemProvider.newOutputStream(ZipFileSystemProvider.java:285)
[ERROR]     at java.nio.file.Files.newOutputStream(Files.java:216)
[ERROR]     at io.quarkus.deployment.pkg.steps.JarResultBuildStep.copyCommonContent(JarResultBuildStep.java:407)
[ERROR]     at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildUberJar(JarResultBuildStep.java:230)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:940)
[ERROR]     ... 7 more

mvn clean install works as usual.

Environment (please complete the following information):

  • Output of uname -a or ver: 5.2.17-200.fc30.x86_64 #1 SMP Mon Sep 23 13:42:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version "1.8.0_222"
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 0.26.1

Additional context
The build also outputs a lot of warnings like:

[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Duplicate entry META-INF/quarkus-extension.json entry from io.quarkus:quarkus-resteasy-jackson::jar:0.26.1(compile) will be ignored. Existing file was provided by io.quarkus:quarkus-resteasy-common::jar:0.26.1(compile)

This should be avoided.

@rvansa rvansa added the bug label Oct 25, 2019
@geoand geoand self-assigned this Oct 25, 2019
@jaikiran

This comment has been minimized.

Copy link
Member

@jaikiran jaikiran commented Oct 25, 2019

FWIW - this appears to be a bug in Java itself. The Files.newOutputStream states that:

<p> This method opens or creates a file in exactly the manner specified
     * by the {@link #newByteChannel(Path,Set,FileAttribute[]) newByteChannel}
     * method with the exception that the {@link StandardOpenOption#READ READ}
     * option may not be present in the array of options. If no options are
     * present then this method works as if the {@link StandardOpenOption#CREATE
     * CREATE}, {@link StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING},
     * and {@link StandardOpenOption#WRITE WRITE} options are present. In other
     * words, it opens the file for writing, creating the file if it doesn't
     * exist, or initially truncating an existing {@link #isRegularFile
     * regular-file} to a size of {@code 0} if it exists.

So this error shouldn't have happened with the code we have.

I gave this a quick test with Java 8 and it indeed fails with the exception. However, if I move to Java 11 (11.0.5 to be precise) the exception no longer happens and things work fine. So it looks like it got fixed in some recent version.

@geoand

This comment has been minimized.

Copy link
Contributor

@geoand geoand commented Oct 25, 2019

I was indeed surprised to see this reported error, however we should work around it.

@jaikiran

This comment has been minimized.

Copy link
Member

@jaikiran jaikiran commented Oct 25, 2019

however we should work around it.

Agreed.

@geoand

This comment has been minimized.

Copy link
Contributor

@geoand geoand commented Oct 25, 2019

I'll open a PR later on today, haven't started working on it yet.

@jaikiran

This comment has been minimized.

Copy link
Member

@jaikiran jaikiran commented Oct 25, 2019

FWIW - this appears to be a bug in Java itself.

https://bugs.openjdk.java.net/browse/JDK-8233015

geoand added a commit to geoand/quarkus that referenced this issue Oct 25, 2019
stuartwdouglas added a commit that referenced this issue Oct 27, 2019
Ensure that subsequent uberJar creations doesn't fail
@gsmet gsmet added this to the 0.27.0 milestone Oct 29, 2019
vsevel added a commit to vsevel/quarkus that referenced this issue Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.