Why Does My Spring Boot 1.5.7 App Hang? Fixing NoSuchMethodError Caused by Jar Conflicts

A Spring Boot 1.5.7 application suddenly stops starting because the main thread is blocked, the stack trace shows a NoSuchMethodError for ObjectUtils.unwrapOptional, which is traced back to a mismatched spring‑context 5.x jar overriding the original 4.x version, and the article explains how to identify and resolve the dependency conflict.

Programmer DD
Programmer DD
Programmer DD
Why Does My Spring Boot 1.5.7 App Hang? Fixing NoSuchMethodError Caused by Jar Conflicts

A Spring Boot project using version 1.5.7 (Spring 4.1.3) suddenly failed to start; the IDE showed the process hanging without any log output. Since no logs were available, the thread stack was inspected using IDEA's built‑in thread dump tool.

Problem Analysis

The stack trace revealed that the main thread was waiting on CountDownLatch.await(). Further inspection of the code showed that the waiting occurs in Spring Boot's safe initialization class, which listens for SpringApplicationEvent events and calls preinitializationComplete.await().

The event object turned out to be a failure event containing the key exception:

NoSuchMethodError: "org.springframework.util.ObjectUtils.unwrapOptional(Ljava/lang/Object;)Ljava/lang/Object;"

Hypothesis

The error indicates a missing method, typically caused by incompatible jar versions. The method exists only in spring‑core 5.x, while the project uses spring‑core 4.1.3. The suspicion was that a recent Maven change introduced a newer spring‑context dependency.

Verification

Checking recent pom.xml commits revealed the addition of:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>5.1.6.RELEASE</version>
</dependency>

Because Maven gives direct dependencies higher priority, this 5.1.6 version overrode the boot‑provided 4.1.3 version, causing the method mismatch.

Solution

Removing the explicit spring-context 5.1.6 dependency (or aligning all Spring modules to the same version) resolves the startup hang; the application starts normally and logs are printed.

Takeaway

When logs are absent, thread dumps can pinpoint where a Java application is stuck. NoSuchMethodError usually points to jar version conflicts; reviewing recent Maven changes and ensuring consistent library versions is essential for quick resolution.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingSpring Bootjar conflictNoSuchMethodErrorMaven Dependency
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.