DEV Community

joe
joe

Posted on

Spring Boot 3.4 Thymeleaf NoClassDefFoundError for org.unbescape.html.HtmlEscape after Upgrade

Description:
I recently upgraded a Spring Boot application from 1.5.7 to 3.4.x and Java from 8 to 21. After the upgrade, the application starts successfully, but when I try to access the login page, it gets stuck in a redirection loop. The console logs show the following error:

log

ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/GFEPWeb] threw exception
[Handler processing failed: java.lang.NoClassDefFoundError: org/unbescape/html/HtmlEscape]

Caused by: java.lang.ClassNotFoundException: org.unbescape.html.HtmlEscape
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

Updated Thymeleaf dependencies in pom.xml:


org.thymeleaf
thymeleaf
3.1.2.RELEASE


org.unbescape
unbescape
1.1.6.RELEASE

What I’ve Tried So Far:
Checked that thymeleaf and unbescape dependencies are present
Cleared the browser cache and restarted the server
Verified that the dependency versions are compatible with Spring Boot 3.4
Checked thymeleaf-extras dependencies

Expected vs. Actual Behavior

Expected:
The login page should render correctly with Thymeleaf processing.

Actual:
The application enters a redirection loop.
The NoClassDefFoundError for org.unbescape.html.HtmlEscape appears in the logs.
If I remove all Thymeleaf tags from the HTML file, the page loads without styling.

Environment Details:
Spring Boot Version: 3.4.0
Java Version: 21
Thymeleaf Version: 3.1.2.RELEASE
Unbescape Version: 1.1.6.RELEASE
Tomcat Version: 10.1.x (Embedded)
Dependency Management: Maven

Questions:
Is org.unbescape.html.HtmlEscape still used in Thymeleaf 3.x, or has it been replaced?
Should I explicitly include unbescape in my dependencies, or does Thymeleaf 3.x manage it internally?
Is there any Thymeleaf migration step I might have missed when upgrading from 1.5.x to 3.4.x?
Any help or guidance would be greatly appreciated! 🙌

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed: Zero in on just the tests that failed in your previous run
  • 2:34 --only-changed: Test only the spec files you've modified in git
  • 4:27 --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • 5:15 --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • 5:51 --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay