Skip to content

Last modified check of Resource created from Tomcat war:file: URL fails with FileNotFoundException [SPR-15485] #20045

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andy Wilkinson opened SPR-15485 and commented

This is, I believe, a regression due to the changes made in this commit. A side-effect of those changes is that AbstractFileResolvingResource now proceeds with file system resolution where as, previously, it would have use the last modified header on the URL connection.

The file system resolution fails with an exception like this:

java.io.FileNotFoundException: Jar URL cannot be resolved to absolute file path because it does not reside in the file system: war:file:/home/vbao/service/vbao-web.war*/js/bootstrap.min.js
	at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:215)
	at org.springframework.core.io.AbstractFileResolvingResource.getFileForLastModifiedCheck(AbstractFileResolvingResource.java:67)
	at org.springframework.core.io.AbstractResource.lastModified(AbstractResource.java:153)
	at org.springframework.core.io.AbstractFileResolvingResource.lastModified(AbstractFileResolvingResource.java:169)
	at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:345)
	…

Affects: 4.3.8

Reference URL: spring-projects/spring-boot#8986

Issue Links:

Referenced from: commits d43dfc7, d298561, 3daf626

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions