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

Specific webjar causes compiler error on Java 11.0.14 #1967

Open
bion opened this issue Apr 21, 2022 · 3 comments
Open

Specific webjar causes compiler error on Java 11.0.14 #1967

bion opened this issue Apr 21, 2022 · 3 comments

Comments

@bion
Copy link

bion commented Apr 21, 2022

The bug occurs for OpenJDK 11.0.14.x but not 11.0.10.x

The bug appears when including the "org.webjars.npm" % "azure__storage-blob" % "10.5.0" library dependency. Including other webjars, including other webjars from azure, do not cause a compilation error.

When azure__storage-blob is included, Java presents a compilation error message ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name for every package name component in the project. E.g.

[error] /home/bionj/dev/civiform/universal-application-tool-0.0.1/app/auth/AccountNonexistentException.java:1:1: cannot access auth
[error]   ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
[error] /home/bionj/dev/civiform/universal-application-tool-0.0.1/app/auth/oidc/AdOidcProvider.java:1:1: cannot access auth.oidc
[error]   ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
[error] /home/bionj/dev/civiform/universal-application-tool-0.0.1/app/auth/saml/InvalidSamlProfileException.java:1:1: cannot access auth.saml
[error]   ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name

etc for all package names

The error message looks like it is coming from a bugfix introduced to OpenJDK here.

Here is a minimal Play project repo with instructions in the README for reproducing the bug: https://github.com/civiform/broken-webjar-repro

@jamesward
Copy link
Member

Looking at the jar:
https://repo1.maven.org/maven2/org/webjars/npm/azure__storage-blob/10.5.0/azure__storage-blob-10.5.0.jar

I don't see anything weird in there. But maybe the jar / unzip tool isn't revealing the strange stuff. I'm deploying 12.9.0 - can you try that version and see if it has the same issue?

@bion
Copy link
Author

bion commented Apr 24, 2022

Thank you for taking a look. Unfortunately 12.9.0 has breaking changes from the previous version so would be less immediately helpful for us.

That being said, I gave it a shot with the demo repo linked in the issue description and received a different error:

[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[info] Updating
[info] Resolved  dependencies
[warn]
[warn] 	Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.webjars.npm:types__node:[0,)
[error]   Not found
[error]   Not found
[error]   not found: /home/bion/.ivy2/localorg.webjars.npm/types__node/[0,)/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/webjars/npm/types__node/[0,)/types__node-[0,).pom
[error] 	at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:345)
[error] 	at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:314)
[error] 	at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] 	at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:314)
[error] 	at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error] 	at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:59)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:133)
[error] 	at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:73)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:146)
[error] 	at scala.util.control.Exception$Catch.apply(Exception.scala:228)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:146)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:127)
[error] 	at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
[error] 	at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:160)
[error] 	at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3690)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] 	at java.base/java.lang.Thread.run(Thread.java:829)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.webjars.npm:types__node:[0,)
[error]   Not found
[error]   Not found
[error]   not found: /home/bion/.ivy2/localorg.webjars.npm/types__node/[0,)/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/webjars/npm/types__node/[0,)/types__node-[0,).pom

Trying the same thing in our actual project (https://github.com/seattle-uat/civiform) got a slightly different error, probably related to us using resolvers += "Shibboleth" at "https://build.shibboleth.net/nexus/content/groups/public" in that project.

[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[info] Updating
[info] Resolved  dependencies
[warn]
[warn] 	Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.webjars.npm:types__node:[0,)
[error]   Not found
[error]   Not found
[error]   not found: /home/bion/.ivy2/localorg.webjars.npm/types__node/[0,)/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/webjars/npm/types__node/[0,)/types__node-[0,).pom
[error]   download error: Caught java.net.URISyntaxException (Illegal character in path at index 85: https://build.shibboleth.net/nexus/content/groups/public/org/webjars/npm/types__node/[0,)/types__node-[0,).pom) while downloading https://build.shibboleth.net/nexus/content/groups/public/org/webjars/npm/types__node/[0,)/types__node-[0,).pom
[error] 	at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:345)
[error] 	at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:314)
[error] 	at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] 	at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:314)
[error] 	at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error] 	at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:59)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:133)
[error] 	at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:73)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:146)
[error] 	at scala.util.control.Exception$Catch.apply(Exception.scala:228)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:146)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:127)
[error] 	at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
[error] 	at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:160)
[error] 	at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3690)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] 	at java.base/java.lang.Thread.run(Thread.java:829)
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.webjars.npm:types__node:[0,)
[error]   Not found
[error]   Not found
[error]   not found: /home/bion/.ivy2/localorg.webjars.npm/types__node/[0,)/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/webjars/npm/types__node/[0,)/types__node-[0,).pom
[error]   download error: Caught java.net.URISyntaxException (Illegal character in path at index 85: https://build.shibboleth.net/nexus/content/groups/public/org/webjars/npm/types__node/[0,)/types__node-[0,).pom) while downloading https://build.shibboleth.net/nexus/content/groups/public/org/webjars/npm/types__node/[0,)/types__node-[0,).pom

@jeffemandel
Copy link

I have this problem as well, in my case with node-fetch. All of the 3.0 versions have this path:

unzip -l 3.0.0-beta.9/node-fetch-3.0.0-beta.9.jar|grep types
     5491  2020-09-19 17:57   META-INF/resources/webjars/node-fetch/3.0.0-beta.9/./@types/index.d.ts

Version 2.6.7 does not. The workaround is to explicitly specify the version in dependencyManagement. I'm guessing the jar shouldn't have a path '.', but this gets introduced algorithmically.
My environment:

mvn --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/mvn
Java version: 17.0.5, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-132-generic", arch: "amd64", family: "unix"

I posted a question on this in StackOverflow; this is a known issue with java, but there doesn't seem to be a fix that would enable a malformed jar to be used.

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

3 participants