JAXB ClassNotFoundException Building Spring Boot App 2.2.0 with Java 11

泄露秘密 提交于 2019-12-05 09:04:59

Starting from Java 9 the JAXB implementation has been removed. So what you have added is only the API and you need to add the implementation also. There might be several alternatives.

As a fix you could add - for example, as there are other implementations also I guess - this dependency:

<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.moxy</artifactId>
    <version>2.7.3</version>
</dependency>

Here is an excellent explanation about this.

Why it has been removed (excerpt from above link):

Java’s standard library isn’t exactly small and lightweight. In the course of the past 20+ years, many features have been added to it, mostly because at the time it was thought that it would be a good idea if Java supported a particular technology out-of-the-box.

One of these was support for XML-based web services. When Java SE 6 was released in December 2006, XML-based web services were popular, so the developers of the Java language thought it would be a good idea if Java would have support for calling web services as a standard feature. It was decided to add the necessary APIs, that were originally developed as part of Java EE, to Java SE. Among these were JAX-WS (Java API for XML-Based Web Services) and JAXB.

With today’s trend towards microservices, it’s important that the Java runtime environment is small and lightweight, so having a large runtime library with built-in support for every possible technology isn’t as advantageous anymore.

Therefore, a proposal was made in JEP-320 to remove the Java EE and CORBA modules from the JDK.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!