Skip to content

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

@dgrandemange

Description

@dgrandemange

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions