Failed to start spring boot in JNLP using Java WebStart

Changed the question. I am trying to run the spring boot application in JNLP, but after fixing all the security issues, I still get this error. This happens during spring boot initialization at startup. This has something to do with the spring boot life cycle somehow and the scope of protection, obviously, but I really don't know how to fix it. JAR runs flawlessly when run as a standalone application with java -jar Test.jar.

Exception from the Java WebStart console:

   Unable to determine code source archive from \\localhost:8080\jnlp\Test.jar
org.springframework.boot.loader.Launcher.createArchive(Launcher.java:151)
        at org.springframework.boot.loader.PropertiesLauncher.<init>(PropertiesLauncher.java:149)
        at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:607)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.javaws.Launcher.executeApplication(Unknown Source)
        at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
        at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
        at com.sun.javaws.Launcher.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

An exception occurs in Launcher.java(spring-boot-tools):

protected final Archive createArchive() throws Exception {
        ProtectionDomain protectionDomain = getClass().getProtectionDomain();
        CodeSource codeSource = protectionDomain.getCodeSource();
        URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
        String path = (location == null ? null : location.getSchemeSpecificPart());
        if (path == null) {
            throw new IllegalStateException("Unable to determine code source archive");
        }
        File root = new File(path);
        if (!root.exists()) {
            throw new IllegalStateException(
                    "Unable to determine code source archive from " + root);
        }
        return (root.isDirectory() ? new ExplodedArchive(root)
                : new JarFileArchive(root));
    }

Spring boot jQuery spring - URI , \localhost: 8080\jnlp\Test.jar, location URI . spring boot Java WebStart.

JNLP:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
    <information>

        <vendor>TEST</vendor>
        <homepage href="http://localhost:8080/" />
        <description>Testing Testing</description>
    </information>
    <update check="timeout" policy="always"/>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+" />
        <jar href="/jnlp/Test.jar" />
    </resources>
    <application-desc main-class="org.springframework.boot.loader.PropertiesLauncher" />
</jnlp>

, Launcher.java spring ?

: , ... spring ( ) , . , path , , ( ).: (

+4
1

, MODULE pom.xml

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <layout>MODULE</layout>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
0

Source: https://habr.com/ru/post/1612379/


All Articles