Skip to content

Resource loading fails in Tomcat when Spring Boot is loaded from the common class loader #22119

@ilinas

Description

@ilinas

Hello there. We have recently attempted to upgrade to Spring Boot 2.3.0 (and then 2.3.1), but unfortunately class loader changes made in #20900 broke our deployment.

We deploy as a skinny WAR (only the application JAR inside WAR) on Tomcat 8.5 where all the libraries are loaded via Tomcats Common class loader (JARs in $CATALINA_HOME/lib). Technically we should be using the Shared class loader, but oh well. We are doing this because we have hundreds of such deployments, so memory usage and disk space is a consideration.

Since #20900 Spring Boot can no longer load resources (like application.properties) if it itself has been loaded by Tomcats Common class loader. Including Spring, Spring Boot, and all other libraries that use Spring annotations inside the WAR file seems to solve the issue, but that is a lot of duplication in our case.

I am not sure if this qualifies as a bug per se, but this is a significant change in behavior, and we are unsure how to best address it?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions