java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory

date
Jul 30, 2022
slug
java-lang-ClassNotFoundException-com-sun-xml-internal-bind-v2-ContextFactory
status
Published
tags
Server
Bugfix
Microservice
Spring Boot
Spring Cloud
summary
type
Post

Background

I’ve created a Eureka Server for my microservice with these dependencies:

Problem

When I tried to run the server, I got the error below :

What’s wrong

Sun people have removed directly access to jaxb package in JDK 11.
So starting with JDK 11 we need to manually include jaxb because it’s not included in the classpath like in JDK 8.

Solution

Include the jaxb-runtime dependency in pom.xml:

References

 

© Foy Wan 2022 - 2025