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

Dealing with java.net.MalformedURLException: Nested JAR URLs are not supported #74

Open
dgrandemange opened this issue Jun 10, 2021 · 0 comments

Comments

@dgrandemange
Copy link

dgrandemange commented Jun 10, 2021

JCL version used : 2.7

Let's say I have a fatjar (webapp with jetty inside) webapp-fat.jar,
which internally includes an api.jar,
which itself includes an api-impl.jar and uses JCL to load classes and resources from it through its specific classloader.

When a class of api-impl.jar tries to load one of its internal resource (say some .properties or .xml), JCL's JarResources.getResourceURL(...) is invoked, which delegates to URL(...) constructor, which in turn delegates to sun's sun.net.www.protocol.jar.Handler.parseURL(URL, String, int, int).

This was working well Java 8u221. but since Java8u241, Sun's sun.net.www.protocol.jar.Handler.parseURL(URL, String, int, int) raises the following exception :

java.net.MalformedURLException: Nested JAR URLs are not supported
complaining that nested JAR URLs are not supported any more.

Indeed, when looking at the URL given to sun.net.www.protocol.jar.Handler.parseURL(...), the resource URL looks like this :

jar:jar:file:/webapp-fat.jar-_ws-any-/webapp/WEB-INF/lib/api.jar!/api-impl.jar!/some-api-impl-resource.xml

Does JCL provide a way to deal with such case ?

See also this stackoverflow topic : MalformedURLException in Java JDK 8 when trying to create an URL

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

1 participant