Skip to content

Jar startup fails on JDK 11 with a SecurityManager enabled #25538

@sascha-kaufmann

Description

@sascha-kaufmann

We currently have a problem, similar to #17796, concerning the start of fat jars with JDK11 and SecurityManager enabled. The same application runs fine on JDK8 with SecurityManager enabled.
We get the following exception (where AbcApplication is the main class, annotated as SpringBootApplication) when starting the jar using command java -Djava.security.manager -Djava.security.policy=security.policy -jar "build\libs\abc-application.jar":

Exception in thread "main" java.lang.ClassNotFoundException: abc.def.AbcApplication
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)

I created a small sample application with spring-boot 2.2.9.RELEASE (see Gist) with the following setup:

  • Gradle (6.0.1) Build, using the spring-boot gradle plugin
  • OpenJDK 11.0.10.9
  • Developing on a windows machine

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions