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

FileNotFoundException is thrown serving resources due to JarUrlConnection.getLastModified() returning zero #38204

Closed
adora-tech opened this issue Nov 3, 2023 · 3 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@adora-tech
Copy link

adora-tech commented Nov 3, 2023

Hello,

First, this problem does not appear in the case of Spring Boot 3.1.5
What I do here is to serve static content from the src\main\resources\static path.
Static content is generated with angular-cli v17, which is a simple project.

I created two simple examples, one with Spring Boot 3.1.5 in which the problem does not appear and works correctly,
and one with Spring Boot 3.2.0 RC2 in which this problem can be observed.

This problem only occurs after the project is assembled with .\gradlew clean assemble and is run with java -jar .\app-sample-sb320-rc2-issue-0.0.1-SNAPSHOT.jar

In the project app-sample-sb320-rc2-issue.zip, you will find in the root, the issue-details directory, which in turn contains files:

browser-access-issue.png
browser-access-issue

log-acces-issue.txt

Attached you will find the two archived projects:

app-sample-sb315-working.zip

app-sample-sb320-rc2-issue.zip

Thank you,
Iulius Ciorica

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 3, 2023
@wilkinsona
Copy link
Member

Thanks for the report and sample app. This appears to be a regression caused by the new nested jar support. The problem does not occur if you switch back to the old support by adding the following to build.gradle:

tasks.named('bootJar') {
    loaderImplementation = org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
}

@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 3, 2023
@wilkinsona wilkinsona added this to the 3.2.x milestone Nov 3, 2023
@philwebb philwebb self-assigned this Nov 5, 2023
@philwebb philwebb changed the title Spring Boot 3.2.0 RC2 Issue - Serve static content FileNotFoundException: class path resource [static/styles-5INURTSO.css] cannot be resolved in the file system for checking its last-modified timestamp FileNotFoundException thrown serving class path resources due to JarUrlConnection.getLastModified() returning 0 Nov 5, 2023
@philwebb philwebb changed the title FileNotFoundException thrown serving class path resources due to JarUrlConnection.getLastModified() returning 0 FileNotFoundException is thrown serving resources due to JarUrlConnection.getLastModified() returning zero Nov 5, 2023
@philwebb philwebb modified the milestones: 3.2.x, 3.2.0 Nov 5, 2023
@philwebb
Copy link
Member

philwebb commented Nov 5, 2023

@adora-tech Thanks so much for finding and raising this one before we released 3.2.0. The sample was super helpful and I think I've identified and fixed the underlying problem.

@wilkinsona
Copy link
Member

Re-opening as some of the new tests are failing on Windows. It looks like a file handle's being leaked which prevents the jar from being deleted during cleanup.

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

4 participants