Skip to content

Executable jars cannot load custom URL handler #31839

Closed as not planned
Closed as not planned
@aoyvx

Description

@aoyvx

The custom URL handler used by my application can be used normally when running in idea, But when I package it into an executable jar, it won't work properly.

example

I have a simple example : ExampleApp, There are two ways to start.
Then open http://127.0.0.1:8080/echo/lei, case two will throw java.net.MalformedURLException.

one

image

two

call java -jar .\ExampleApp-0.0.1-SNAPSHOT.jar -Djava.protocol.handler.pkgs=com.example.exampleapp in terminal

java.net.MalformedURLException: unknown protocol: echo
        at java.base/java.net.URL.<init>(URL.java:681) ~[na:na]
        at java.base/java.net.URL.<init>(URL.java:569) ~[na:na]
        at java.base/java.net.URL.<init>(URL.java:516) ~[na:na]
        at com.example.exampleapp.ExampleAppApplication.echo(ExampleAppApplication.java:22) ~[classes!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.22.jar!/:5.3.22]

Is there any plan to make it work normally?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions