Skip to content

Exception when instanciating JarLauncher from spring-boot-starter-web #49149

@arnaultbonafos

Description

@arnaultbonafos

I attempt to use a SpringApplication started from spring-boot-starter-web packaged jar file, from within an existing Plugin architecture.

For that I do :

Class<?> starterclass = Class.forName("org.springframework.boot.loader.launch.JarLauncher", true, jarloader);

Then when I want to invoke the "launch" method I get the following exception:

Caused by: java.lang.IllegalStateException: java.net.MalformedURLException: unknown protocol: nested
        at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.<clinit>(JarUrlConnection.java:67)
        ... 30 more
Caused by: java.net.MalformedURLException: unknown protocol: nested
        at java.base/java.net.URL.<init>(URL.java:779)
        at java.base/java.net.URL.<init>(URL.java:654)
        at java.base/java.net.URL.<init>(URL.java:590)
        at java.base/java.net.JarURLConnection.parseSpecs(JarURLConnection.java:176)
        at java.base/java.net.JarURLConnection.<init>(JarURLConnection.java:158)
        at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.<init>(JarUrlConnection.java:92)
        at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.<clinit>(JarUrlConnection.java:64)
        ... 30 more

I have looked at the Code around JarUrlConnection:64, and a static initializer throws the IllegalException.
I suspect a bug but it could be that I doing something wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions