Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException can be thrown when running an uber jar on a shared drive #40549

Open
madalinaandreeab opened this issue Apr 26, 2024 · 4 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@madalinaandreeab
Copy link

Hi,

I recently upgraded from spring boot 3.1.7 to 3.2.5 and I am getting an IllegalArgumentException when I am using my service, which is stored as a jar on a shared drive.

I created a simple Eureka server app to demonstrate the issue: https://github.com/madalinaandreeab/eureka-server-demo

I placed the eureka-server-demo-0.0.1-SNAPSHOT.jar file in the \myshare\drive\users\mab\ shared drive and I started the service using the following command:
java -jar \\myshare\drive\users\mab\eureka-server-demo-0.0.1-SNAPSHOT.jar

The service starts successfully, but when I access the Eureka UI at http://localhost:8761/, I am getting the error below.

Please notice that the error refers to the C:\drive\users\mab\eureka-server-demo-0.0.1-SNAPSHOT.jar path which doesn't exist; The right path would be \\myshare\drive\users\mab\eureka-server-demo-0.0.1-SNAPSHOT.jar.

2024-04-26T17:48:41.756+03:00  INFO 25772 --- [           main] c.m.e.EurekaServerDemoApplication        : Started EurekaServerDemoApplication in 5.124 seconds (process running for 20.885)
2024-04-26T17:48:49.177+03:00  INFO 25772 --- [nio-8787-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-04-26T17:48:49.178+03:00  INFO 25772 --- [nio-8787-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-04-26T17:48:49.179+03:00  INFO 25772 --- [nio-8787-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
2024-04-26T17:48:49.297+03:00 ERROR 25772 --- [nio-8787-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.IllegalArgumentException: C:\drive\users\mab\eureka-server-demo-0.0.1-SNAPSHOT.jar must be a regular file] with root cause

java.lang.IllegalArgumentException: C:\drive\users\mab\eureka-server-demo-0.0.1-SNAPSHOT.jar must be a regular file
        at org.springframework.boot.loader.zip.FileDataBlock$FileAccess.<init>(FileDataBlock.java:180) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.FileDataBlock.<init>(FileDataBlock.java:52) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent$Loader.loadNonNested(ZipContent.java:563) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent$Loader.load(ZipContent.java:549) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:384) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:361) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent$Loader.load(ZipContent.java:551) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:384) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:373) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.net.protocol.nested.NestedUrlConnectionResources.connect(NestedUrlConnectionResources.java:54) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.net.protocol.nested.NestedUrlConnection.connect(NestedUrlConnection.java:196) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.net.protocol.nested.NestedUrlConnection.getInputStream(NestedUrlConnection.java:187) ~[eureka-server-demo-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at freemarker.cache.URLTemplateSource.lastModified(URLTemplateSource.java:89) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.cache.URLTemplateLoader.getLastModified(URLTemplateLoader.java:50) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.cache.MultiTemplateLoader$MultiSource.getLastModified(MultiTemplateLoader.java:142) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.cache.MultiTemplateLoader.getLastModified(MultiTemplateLoader.java:99) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:439) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:293) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.template.Configuration.getTemplate(Configuration.java:2910) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.getTemplateForInclusion(Environment.java:3062) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.getTemplateForInclusion(Environment.java:3024) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.getTemplateForImporting(Environment.java:3186) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.importLib(Environment.java:3171) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.importLib(Environment.java:3135) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.LibraryLoad.accept(LibraryLoad.java:65) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.visit(Environment.java:335) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.visit(Environment.java:341) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.core.Environment.process(Environment.java:314) ~[freemarker-2.3.32.jar!/:2.3.32]
        at freemarker.template.Template.process(Template.java:383) ~[freemarker-2.3.32.jar!/:2.3.32]
        at org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:332) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:266) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:220) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:181) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:314) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1431) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1167) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1106) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.1.6.jar!/:6.1.6]
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.6.jar!/:6.1.6]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:175) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:150) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.20.jar!/:na]
        at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]

Thank you!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 26, 2024
@scottfrederick
Copy link
Contributor

Thanks for the report. Can you confirm that your app works with Spring Boot 3.2.5 with the "classic" loader fallback implementation as described in the release notes?

@scottfrederick scottfrederick added the status: waiting-for-feedback We need additional information before we can continue label Apr 26, 2024
@madalinaandreeab
Copy link
Author

Hi @scottfrederick ,

Yes, it does. I have the following plugin in the pom file of the original service where I discovered the issue:

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<configuration>
		<mainClass>${mainClass}</mainClass>
	</configuration>
	<executions>
		<execution>
			<goals>
				<goal>repackage</goal>
			</goals>
			<configuration>
				<loaderImplementation>CLASSIC</loaderImplementation>
			</configuration>
		</execution>
	</executions>
</plugin>

Thanks!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 26, 2024
@philwebb philwebb added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Apr 26, 2024
@philwebb philwebb added this to the 3.2.x milestone Apr 26, 2024
@philwebb philwebb changed the title IllegalArgumentException when using spring boot service stored on a shared drive IllegalArgumentException can be thrown when running an uber jar on a shared drive Apr 26, 2024
@dmuszkat
Copy link

Hello please note that windows share drive can be as follow
"\server\Share$"
Or
"\server\Share\dir1\DIR2"
Or
"\server\Share\my path with spaces"
Or
"\server\Share\because\IamFrench\Iuse èéà"

I mean we can have specific accent characters with or without spaces even if those are not good practises sometimes we do not choose where the users want to store the jar

Thank you

David Muszkatblit

@madalinaandreeab
Copy link
Author

Hi,

Upon further investigation, I believe this issue may be connected to #39675.

Thanks!

@philwebb philwebb self-assigned this May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

5 participants