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.

@wilkinsona wilkinsona reopened this Nov 8, 2023
@philwebb philwebb closed this as completed Nov 8, 2023
ndwlocatieservices added a commit to ndwnu/nls-routing-map-matcher that referenced this issue Nov 6, 2024
…o v3.2.0

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls.geometry:nls-geometry](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.2` -> `3.2.0` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (nu.ndw.nls.geometry:nls-geometry)</summary>

### [`v3.2.0`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.0)

[Compare Source](spring-projects/spring-boot@v3.1.2...v3.2.0)

#### ⭐ New Features

-   Auto-configure observations for RestClients [#&#8203;38500](spring-projects/spring-boot#38500)
-   Add support for Oracle Free, the replacement for Oracle XE, with Testcontainers and Docker Compose [#&#8203;38476](spring-projects/spring-boot#38476)
-   Provide dependency management for org.crac:crac [#&#8203;38378](spring-projects/spring-boot#38378)
-   Add new properties for Liquibase 4.24.0 [#&#8203;38274](spring-projects/spring-boot#38274)
-   Provide a way to create custom ApplicationContextFactory in SpringBootContextLoader [#&#8203;38205](spring-projects/spring-boot#38205)
-   Report friendly error when failing to find AOT initializer [#&#8203;38188](spring-projects/spring-boot#38188)

#### 🐞 Bug Fixes

-   Annotation based ConditionalOnBean checks can cause early initialization of FactoryBeans [#&#8203;38507](spring-projects/spring-boot#38507)
-   CRaC restoration fails when Actuator's running on a separate port [#&#8203;38502](spring-projects/spring-boot#38502)
-   App that depends on Tomcat and on Jetty's websocket-server module fails to start with IllegalStateException: WebSocketComponents has not been created [#&#8203;38286](spring-projects/spring-boot#38286)
-   App fails to start with a NoSuchMethodError when using Flyway 10.0.0 [#&#8203;38268](spring-projects/spring-boot#38268)
-   MeterRegistry throws BeanCreationNotAllowedException on shutdown [#&#8203;38240](spring-projects/spring-boot#38240)
-   Resolution of productionRuntimeClasspath configuration may select the wrong variant and contain a dependency's source jar [#&#8203;38233](spring-projects/spring-boot#38233)
-   Docker JSON parsing fails on certain locales [#&#8203;38220](spring-projects/spring-boot#38220)
-   FileNotFoundException is thrown serving resources due to JarUrlConnection.getLastModified() returning zero [#&#8203;38204](spring-projects/spring-boot#38204)
-   Failed to extract parameter names exception thrown when binding with non-enumerable property source [#&#8203;38201](https://github.com/spring-projects/spring...
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