-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Description
Description
We've encountered an issue when starting a JAR built with the spring-boot-maven-plugin via the command line using UNC paths on Windows. Specifically, when attempting to run a Spring Boot application with a command like:
"...java.exe" -jar "\\some-unc-path\c\...\...-SNAPSHOT.jar"The application fails during startup due to errors related to the resolution of nested jar URLs. It appears that Spring Boot’s class loader helper classes are unable to correctly resolve the path when using UNC paths (e.g., \\server\share\...).
Observations
This problem seems to be tied to how Spring Boot handles URLs for nested jars when referenced via UNC paths on Windows. The same setup works perfectly with standard file paths, but fails when UNC paths are involved.
We noticed that Spring Boot does include some handling for network paths, but it appears that this case isn't properly covered.
We believe the root of the issue might lie in the following code within NestedLocation (line 75):

As shown by the debugger, the getPath() call seems to strip away the host information from the UNC path, leaving only the path component, which leads to incorrect resolution.
Environment
- OS: Occurs on both Windows 11 and Windows 10
- Spring Boot Version: 3.2.1
- Java 17
Expected Behaviour
Spring Boot should correctly resolve and load nested jar files from a UNC path just as it does with local file paths.
Actual Behaviour
When using a UNC path, the application fails to start due to incorrect path resolution of the nested jars.
Steps to Reproduce:
- Place the Spring Boot jar file on a network share using a UNC path (e.g.,
\\server\share\app.jar). - Run the jar using the command line with the UNC path.
- Observe the startup failure due to nested jar URL resolution issues.
Request for Help:
We would greatly appreciate any guidance or suggestions on how to fix or work around this issue. Are there any configurations or patches that might resolve this UNC path handling problem?
Thank you!