Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

A project imports both spring-boot-dependencies and a cloud vendor SDK BOM. After an upgrade, Netty classes fail with NoSuchMethodError at runtime. How do imported BOMs interact, and how do you find and fix the conflict?

When two imported BOMs manage the same artifact, the one declared first in dependencyManagement wins, and versions declared directly in our own dependencyManagement win over all imports. After the upgrade, the vendor BOM was probably first and pinned an older Netty than Spring Boot needs, so Boot's code calls a Netty method that the older jar does not have. We find it with mvn dependency:tree -Dverbose and mvn help:effective-pom -Dverbose, fix it by importing netty-bom first or pinning Netty explicitly, and add a test that exercises the Netty path so the conflict fails the build instead of production.

Why this question is asked

NoSuchMethodError is the classic symptom of a dependency version conflict: the code was compiled against one version of a library and runs against another, where the method does not exist or has a different signature. It compiles fine and often passes unit tests, and then fails at runtime, sometimes only on a specific request path. Interviewers ask this debugging question because solving it requires knowing exactly how Maven chooses versions when several BOMs are involved. In this answer, we will see how imported BOMs interact, reproduce how the wrong Netty was chosen, find it with the right commands, fix it, and make sure it cannot slip into production again.

1A Quick Recap of NoSuchMethodError

java.lang.NoSuchMethodError is thrown when running code calls a method that does not exist in the class the JVM loaded. The compiler checked that the method existed in the version it compiled against, so the error means the runtime classpath holds a different version of the class than the code expected. Here, Spring Boot's reactive networking code, compiled against a recent Netty, calls a method that the Netty jar actually on the classpath does not have.

Netty is split into many modules, netty-buffer, netty-codec-http, netty-handler and so on, and they must all be the same version. A mix of versions across modules produces exactly this kind of error, which is why Netty publishes netty-bom to keep its modules aligned.

2How Imported BOMs Interact

Maven builds one effective dependencyManagement for the project. Entries declared directly in our POM's dependencyManagement go in first, and they always win. Then each imported BOM is merged in the order the imports are declared. If an artifact is already managed, a later import does not replace it. So among imports, the first declared wins, and there is no warning when a later BOM disagrees.

In this project, the cloud vendor's SDK BOM was declared before spring-boot-dependencies. The vendor BOM manages Netty, because its SDK uses Netty for HTTP, and after the upgrade of Spring Boot, the vendor BOM still pins an older Netty version. Since it comes first, its Netty version wins for every Netty module it lists, and possibly not for the modules it does not list, which leaves a mix.

Step throughHow Maven picks the managed version of io.netty:netty-handler
  1. Declared directly in our dependencyManagement?
    Yesuse that versionNocheck the imports in order
  2. Managed by the first imported BOM (vendor SDK)?
    Yesuse the vendor's older version: wins silentlyNocheck the next import
  3. Managed by the next imported BOM (Spring Boot)?
    Yesuse Boot's versionNouse the version from the dependency tree

3 steps in order. Play them, or step through them one at a time.

There is no warning when a later BOM disagrees with an earlier one.

3Finding the Conflict

The first step is to see which Netty version was actually chosen for each module and where it came from. mvn dependency:tree with -Dverbose shows the resolved tree, including notes when a version was managed from another one, and -Dincludes filters it to Netty.

Shell
$ mvn dependency:tree -Dverbose -Dincludes=io.netty
[INFO] com.example:orders:jar:2.0.0
[INFO] +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:3.5.0:compile
[INFO] | \- io.projectreactor.netty:reactor-netty-http:jar:1.2.x:compile
[INFO] | +- io.netty:netty-codec-http:jar:4.1.100.Final:compile (version managed from 4.1.12x.Final)
[INFO] | \- io.netty:netty-handler:jar:4.1.100.Final:compile (version managed from 4.1.12x.Final)
[INFO] \- com.vendor:cloud-sdk-core:jar:5.3.0:compile
[INFO] \- io.netty:netty-transport-native-epoll:jar:4.1.12x.Final:compile
$ mvn help:effective-pom -Dverbose
...
<artifactId>netty-handler</artifactId>
<version>4.1.100.Final</version> <!-- com.vendor:cloud-sdk-bom:5.3.0, line 212 -->

The version numbers are illustrative. The pattern is what matters: reactor-netty asked for a newer Netty, but the managed version forced it down to 4.1.100, and one Netty module even ended up on a different version from the others. help:effective-pom with -Dverbose annotates each element of the effective POM with the file and line it came from, so we can see that the vendor BOM supplied the Netty version. Searching the stack trace of the NoSuchMethodError for the class name, then finding that class's jar on the classpath, confirms it.

4Fixing It

There are two good fixes, and they can be combined. The first is to import the library's own BOM, netty-bom, first, at the version Spring Boot expects. It manages every Netty module at one version, so the modules stay aligned. The second is to reorder the other imports so that spring-boot-dependencies comes before the vendor BOM, if Boot's version of the overlapping libraries is the one we want in general.

XML
<dependencyManagement>
<dependencies>
<dependency> <!-- 1. aligns every Netty module, wins over both BOMs -->
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version> <!-- the version Boot documents for this release -->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency> <!-- 2. Boot before the vendor BOM -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.vendor</groupId>
<artifactId>cloud-sdk-bom</artifactId>
<version>5.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

After the change, dependency:tree should show the same Netty version for every module. We must also check that the vendor SDK works with the newer Netty; Netty is usually compatible within a minor line, but the vendor's release notes or a quick test of the SDK's calls is worth the time. If the vendor SDK genuinely needs the older version, the conflict cannot be solved by ordering alone, and we would look for a newer SDK release or a variant of the SDK that uses a different HTTP client.

The explicit order also documents intent. A comment above the imports saying which BOM owns which libraries saves the next person from repeating this investigation. This behaviour is how Maven 3 merges imports; check the documentation if the project moves to a newer Maven major version.

5Catching It Before Production

This bug reached runtime because nothing in the build exercised the Netty code path with the real classpath. Two safeguards help. A test that starts the application context, for example a @SpringBootTest that sends one request through WebClient or starts the reactive server, loads the Netty classes and fails at build time with the same NoSuchMethodError. And the Maven Enforcer plugin's requireUpperBoundDeps rule fails the build when a resolved version is lower than one requested by a dependency, which is exactly what happened here when reactor-netty asked for a newer Netty than the managed one.

Step throughWhere the error surfaces with and without a startup test
CI buildStartup testProduction
@SpringBootTest: start context, call WebClient once
NoSuchMethodError: build fails
without the test: deploy passes
first reactive request: NoSuchMethodError

4 messages in order. Play them, or step through them one at a time.

6Follow-up questions

Why did unit tests not catch it?

Unit tests usually mock HTTP clients and never load the Netty classes involved, and NoSuchMethodError only happens when the JVM links the call at runtime. A test that runs the real code path on the real classpath is needed to surface it.

Could we use exclusions instead?

Excluding Netty from the vendor SDK dependency does not help when the problem is the managed version, because dependencyManagement applies to all paths. Managing the version correctly, with netty-bom first, is the direct fix.

How do we prevent this on the next upgrade?

Keep the BOM order documented, keep requireUpperBoundDeps enabled, and keep the startup test. Upgrade bots then open pull requests whose CI shows the conflict immediately.

7Conclusion

In this answer, we saw that Maven merges imported BOMs in declaration order, so the first BOM that manages an artifact wins, and versions declared directly in our dependencyManagement win over all imports. The vendor BOM, declared first, forced an older Netty under Spring Boot's code, causing NoSuchMethodError. mvn dependency:tree -Dverbose and help:effective-pom -Dverbose show the chosen version and its origin; importing netty-bom first and reordering the BOMs fixes it, and a startup test plus requireUpperBoundDeps catch it at build time.

What to say in the interviewAbout 80 seconds aloud

Open with

NoSuchMethodError means code was compiled against one version of a class and runs with another, so I immediately suspect a version conflict, and with Netty that often means mixed module versions.

Then, if they want more

With imported BOMs, Maven merges them in declaration order, and the first import that manages an artifact wins without any warning; anything I declare directly in my own dependencyManagement wins over all imports. So if the vendor BOM is declared before spring-boot-dependencies, its older Netty version is used, even though reactor-netty in the new Boot release needs a newer one.

To find it, I run mvn dependency:tree with -Dverbose and -Dincludes=io.netty, which shows the resolved versions and notes like version managed from, and mvn help:effective-pom with -Dverbose, which shows which file and line supplied each managed version.

To fix it, I import netty-bom first at the version Boot expects, which keeps every Netty module on one version, and put spring-boot-dependencies before the vendor BOM. Then I verify that the vendor SDK works with the newer Netty.

Finally, I make sure it cannot reach production again: a SpringBootTest that actually sends a request through the Netty path, so the error fails the build, and the Enforcer rule requireUpperBoundDeps, which catches a managed version lower than what a dependency asked for.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Maven guides
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "A project imports both spring-boot-dependencies and a cloud vendor SDK BOM. After an...": https://scrivio-interview-library.netlify.app/java/maven/e8af6997c1/