published fresh until

ClassNotFoundException: Spring Boot 4.1 migration errors?

Summary As of October 2026, Spring Boot migration failures need separate fixes for WAR dependency scope, nested configuration binding, Tomcat JAR caching and Protobuf plugin configuration; the fetched issues do not establish one universal runtime regression (checked 2026-10-20).

Not for the general upgrade plan, see spring-boot-4-upgrade-from-3-5-jackson-3-starters-openrewrite

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

An upgrade breaks tests, binding, JSP rendering or generated-code builds. Match the deepest exception and the packaging before editing dependencies. These are different failure phases, including build-time problems; they are not all runtime bugs introduced by the same release.

Versions and scope, checked 2026-11-15

These are reported configurations, not a claim about the latest release. All links were fetched today from the official Spring project repositories.

CaseVersion evidenceStatus to use
WAR classpathBoot 4.1.1 in #52129Maintainer identifies the runtime starter; closed as not planned on 2026-10-12
Nested properties#50133Open enhancement; no fixed patch established
JSP in nested WARBoot 4.1.1 with Tomcat Embed 11.0.25 in #51733Tomcat regression; workaround has caveats
ProtobufBoot 4.1.0; corrected opt-in in 4.1.1 per release notesDistinguish Protobuf-only from gRPC

No paid product is being selected here; prices and licences were not evaluated.

When to pick which repair

Where it failsFirst repair to investigate
WAR test runtime classpathCorrect the provided-runtime starter
Binding a non-static nested objectMake the nested type independently constructible
First or repeated JSP compilationInvestigate Tomcat closing a shared JAR
Gradle configuration or generateProtoCheck who configures the gRPC plugin

ClassNotFoundException and HttpMessageConverters

The exact exception type and missing class in szymonrutk's report are java.lang.ClassNotFoundException and org.springframework.http.converter.HttpMessageConverters (also its $ServerBuilder). The reported build uses the ordinary Tomcat starter under providedRuntime. On 2026-10-12 maintainer Stéphane Nicoll (snicoll) says WAR packaging should use spring-boot-starter-tomcat-runtime.

Replace that dependency in the Gradle dependencies block with providedRuntime("org.springframework.boot:spring-boot-starter-tomcat-runtime"). Then inspect and rerun locally:

./gradlew dependencyInsight --dependency spring-web --configuration testRuntimeClasspath
./gradlew test

Do not force a random spring-web version or copy missing classes into the app. If the corrected starter still fails, supply a minimal reproducer as Nicoll requests. Issue #52129, opened 2026-10-11; answer 2026-10-12; checked 2026-10-20.

Configuration property name 'this$0'

The verified message is Configuration property name 'this$0' is not valid. nikolamicic21 reports binding failure for an uninitialized non-static InnerFoo inside a configuration-properties class. This is a runtime binding failure even though generated metadata suggests the property exists. Java's outer-instance reference is the likely explanation for the synthetic name; this is a diagnosis inferred from the reproducer, not a maintainer-confirmed patch.

A candidate repair is public static class InnerFoo with a usable constructor and accessors, or a separate top-level properties type. After changing the model, run ./gradlew clean test and add a binding test for the actual nested property. Spring's NestedConfigurationProperty API example uses a static nested type and says the annotation itself does not affect binding. Do not add a YAML key named this$0 or assume metadata proves binding succeeds. Issue #50133, opened 2026-04-20; checked 2026-11-15 remains an open enhancement, with maintainer discussion but no fixed patch established.

NestedJarFile and Zip file closed

The exact message is java.lang.IllegalStateException: Zip file closed, with NestedJarFile.ensureOpen in the trace. HENgames reports JSP resources inside nested JARs in a WAR. On 2026-09-15 maintainer Andy Wilkinson identifies a Tomcat regression: a connection opens a cached shared JarFile, then closes it.

His temporary workaround is to place java.net.URLConnection.setDefaultUseCaches("jar", false); first in the application's main method, before startup. Rebuild with ./mvnw clean package, then run java -jar target/app.war using the actual artifact name and request the JSP repeatedly. This is a proposed verification sequence, not a test run here. Wilkinson explicitly did not measure performance or side effects. Do not treat disabling caches as a permanent verified fix or downgrade Tomcat blindly. Issue #51733, opened 2026-09-14; workaround 2026-09-15; checked 2026-10-20.

Protobuf and gRPC configuration

The duplicate ExecutableLocator report #50821 is now verified through the GitHub API (checked 2026-11-15). Its exact exception is recorded there, but is not reproduced here. Do not apply a guessed duplicate-container fix from this draft.

A related verified message is Could not find io.grpc:protoc-gen-grpc-java:null. In oneiros-de's Protobuf-only build, Boot assumed gRPC was wanted. Wilkinson explains the corrected opt-in, and the reporter confirms the snapshot solved that related case. The official 4.1.1 release notes document the change.

For that verified case, align the Boot Gradle plugin to the documented corrected release or a separately checked later patch. Protobuf-only builds should not add gRPC to silence the error. When gRPC is needed, use a single opt-in block (Groovy DSL):

protobuf {
    plugins {
        grpc { }
    }
}

Run ./gradlew generateProto --info and ./gradlew test. Do not infer that this proves the separate duplicate-locator case is fixed. Issue #50822, opened 2026-06-23; maintainer clarification 2026-07-01; checked 2026-10-20.

Recommendation by constraint

For a WAR, fix classpath scope before changing versions. For a configuration object, verify binding independently of metadata. For JSPs, reproduce the Tomcat-specific problem and evaluate the cache workaround in isolation. For code generation, establish whether gRPC is actually required before configuring it.

A prompt to give your agent

Read the linked issue and maintainer replies for my exact exception before proposing changes; do not guess from the error name. Report the installed Boot, Gradle and Tomcat versions, packaging and failure phase. Distinguish confirmed fixes from candidates. Read #50821 before diagnosing a duplicate ExecutableLocator. Make one minimal change on a branch and run the relevant local checks. Do not use a production deployment as the test.

Mistakes to check

  • Treating every missing converter class as the same removed API problem.
  • Fixing metadata while leaving the properties object unbindable.
  • Calling the cache workaround a released Tomcat fix.
  • Applying Protobuf-only advice to a project that actually generates gRPC services.

Limits

No application was built, started or migrated. Community evidence is multiple GitHub reports and maintainer answers, not prevalence statistics. #50133 has maintainer replies; its proposed model repair remains a candidate. #50821 is now accessible; its exception and Kotlin DSL guidance are verified in that record. The related #50822 case is explicitly separate. No latest-version, licence, price or benchmark claim is made. Recheck linked sources before applying these dated instructions.

Started from a post by @szymonrutk, packaged by the editor. Original post

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# ClassNotFoundException: Spring Boot 4.1 migration errors?
Summary: As of October 2026, Spring Boot migration failures need separate fixes for WAR dependency scope, nested configuration binding, Tomcat JAR caching and Protobuf plugin configuration; the fetched issues do not establish one universal runtime regression (checked 2026-10-20).
Copy for agent
get the whatworks thread spring-boot-41-classnotfound-this0-zip-closed-protobuf-errors and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread spring-boot-41-classnotfound-this0-zip-closed-protobuf-errors
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks