web-dev-qa-db-ja.com

Java 11を使用したJAXB ClassNotFoundExceptionビルドSpring Boot App 2.2.0

バージョン2.2.0.BUILD-SNAPSHOTを使用して、Spring BootアプリケーションをJava 11(以下のPOM)で)作成しました:

 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.Apache.org/POM/4.0.0" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 
  http://maven.Apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.0.BUILD-SNAPSHOT</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mycompany</groupId>
<artifactId>Eureka-Service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Eureka-Service</name>
<description>Spring Boot Eureka Service</description>

<properties>
    <Java.version>11</Java.version>
    <spring-cloud.version>Greenwich.BUILD-SNAPSHOT</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>
</project>

アプリが起動すると、次の例外がスローされます。

2018-12-30 14:09:43.584  INFO 1305 --- [           main] 
    c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec 
   XStreamXml
   2018-12-30 14:09:43.584  INFO 1305 --- [           main] 
   c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec 
    XStreamXml
    2018-12-30 14:09:43.710 ERROR 1305 --- [           main] c.s.j.s.i.w.WadlApplicationContextImpl   : Implementation of JAXB-API has not been found on module path or classpath.

javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.Java:177) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.ContextFinder.find(ContextFinder.Java:364) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.Java:508) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.Java:465) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.Java:366) ~[jaxb-api-2.3.1.jar:2.3.0]
    at com.Sun.jersey.server.impl.wadl.WadlApplicationContextImpl.<init>(WadlApplicationContextImpl.Java:107) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.wadl.WadlFactory.init(WadlFactory.Java:100) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.RootResourceUriRules.initWadl(RootResourceUriRules.Java:169) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.Java:106) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.Java:1359) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.Java:180) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.Java:799) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.Java:795) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.inject.Errors.processWithErrors(Errors.Java:193) ~[jersey-core-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.Java:795) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.Java:790) ~[jersey-server-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.Java:509) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.Java:339) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.Java:605) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.Java:207) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.Java:394) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at com.Sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.Java:744) ~[jersey-servlet-1.19.1.jar:1.19.1]
    at org.Apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.Java:270) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.Java:106) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardContext.filterStart(StandardContext.Java:4511) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5157) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1382) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1372) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at Java.base/Java.util.concurrent.FutureTask.run(FutureTask.Java:264) ~[na:na]
    at org.Apache.Tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.Java:75) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at Java.base/Java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.Java:140) ~[na:na]
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:907) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardHost.startInternal(StandardHost.Java:831) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1382) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1372) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at Java.base/Java.util.concurrent.FutureTask.run(FutureTask.Java:264) ~[na:na]
    at org.Apache.Tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.Java:75) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at Java.base/Java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.Java:140) ~[na:na]
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:907) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardEngine.startInternal(StandardEngine.Java:262) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardService.startInternal(StandardService.Java:423) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.core.StandardServer.startInternal(StandardServer.Java:933) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:183) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.Apache.catalina.startup.Tomcat.start(Tomcat.Java:398) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.initialize(TomcatWebServer.Java:106) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.<init>(TomcatWebServer.Java:86) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.web.embedded.Tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.Java:414) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.web.embedded.Tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.Java:174) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.Java:181) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.Java:154) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:540) ~[spring-context-5.1.4.BUILD-SNAPSHOT.jar:5.1.4.BUILD-SNAPSHOT]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.Java:142) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:775) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:397) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:316) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1260) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1248) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at com.orbis.EurekaServiceApplication.main(EurekaServiceApplication.Java:13) ~[classes/:na]
Caused by: Java.lang.ClassNotFoundException: com.Sun.xml.internal.bind.v2.ContextFactory
    at org.springframework.boot.web.embedded.Tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.Java:70) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
    at org.Apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.Java:1173) ~[Tomcat-embed-core-9.0.14.jar:9.0.14]
    at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.Java:122) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.Java:155) ~[jaxb-api-2.3.1.jar:2.3.0]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.Java:174) ~[jaxb-api-2.3.1.jar:2.3.0]
    ... 61 common frames omitted

2018-12-30 14:09:43.790  WARN 1305 --- [           main] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2018-12-30 14:09:43.790  WARN 1305 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2018-12-30 14:09:43.791  INFO 1305 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2018-12-30 14:09:43.922  INFO 1305 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2018-12-30 14:09:44.330  INFO 1305 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2018-12-30 14:09:44.368  INFO 1305 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2018-12-30 14:09:44.368  INFO 1305 --- [           main] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2018-12-30 14:09:44.378  INFO 1305 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1546178984375 with initial instances count: 0
2018-12-30 14:09:44.405  INFO 1305 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2018-12-30 14:09:44.406  INFO 1305 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Adding new peer nodes [http://localhost:8761/eureka/]
2018-12-30 14:09:44.583  INFO 1305 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2018-12-30 14:09:44.584  INFO 1305 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2018-12-30 14:09:44.584  INFO 1305 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2018-12-30 14:09:44.584  INFO 1305 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2018-12-30 14:09:44.668  INFO 1305 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Replica node URL:  http://localhost:8761/eureka/
2018-12-30 14:09:44.675  INFO 1305 --- [           main] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2018-12-30 14:09:44.675  INFO 1305 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initialized
2018-12-30 14:09:44.682  INFO 1305 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-12-30 14:09:44.741  INFO 1305 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2018-12-30 14:09:44.744  INFO 1305 --- [      Thread-12] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2018-12-30 14:09:44.745  INFO 1305 --- [      Thread-12] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2018-12-30 14:09:44.745  INFO 1305 --- [      Thread-12] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2018-12-30 14:09:44.754  INFO 1305 --- [      Thread-12] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2018-12-30 14:09:44.755  INFO 1305 --- [      Thread-12] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2018-12-30 14:09:44.755  INFO 1305 --- [      Thread-12] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2018-12-30 14:09:44.755  INFO 1305 --- [      Thread-12] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2018-12-30 14:09:44.755  INFO 1305 --- [      Thread-12] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2018-12-30 14:09:44.761  INFO 1305 --- [      Thread-12] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2018-12-30 14:09:44.775  INFO 1305 --- [           main] o.s.b.w.embedded.Tomcat.TomcatWebServer  : Tomcat started on port(s): 8761 (http) with context path ''
2018-12-30 14:09:44.775  INFO 1305 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761
2018-12-30 14:09:44.777  INFO 1305 --- [           main] com.orbis.EurekaServiceApplication       : Started EurekaServiceApplication in 4.097 seconds (JVM running for 5.186)
2018-12-30 14:10:44.762  INFO 1305 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0msaa

ただし、次の依存関係を削除すると、

<dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.1</version>
    </dependency>

アプリケーションの起動に失敗します:

Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.initialize(TomcatWebServer.Java:125) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.<init>(TomcatWebServer.Java:86) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.embedded.Tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.Java:414) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.embedded.Tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.Java:174) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.Java:181) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.Java:154) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
... 8 common frames omitted
Caused by: Java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.Java:171) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.initialize(TomcatWebServer.Java:109) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar:2.2.0.BUILD-SNAPSHOT]
... 13 common frames omitted
9
Orby

Java 9から始まり、JAXB実装が削除されました。追加したのはAPIだけであり、実装も追加する必要があります。いくつかの選択肢がある場合があります。

あなたが追加できる修正として-たとえば、他の実装もあると思います-この依存関係:

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

ここ はこれについての優れた説明です。

削除された理由(上記のリンクからの抜粋):

Javaの標準ライブラリは正確に小さく軽量ではありません。過去20年以上の間に、多くの機能が追加されました。これは、主に、当時、Javaが特定の技術をサポートしていた場合、それは良い考えであると考えられていたためです。ボックスの。

これらの1つは、XMLベースのWebサービスのサポートでした。 Java SE 6が2006年12月にリリースされたとき、XMLベースのWebサービスが人気だったので、Java言語の開発者はそれが良いアイデアだと思ったif Javaは、標準機能としてWebサービスの呼び出しをサポートします。元々Java EEの一部として開発された、必要なAPIを追加することが決定されました。 Java SE。これらの中には、JAX-WS(XMLベースのWebサービス用のJava API)およびJAXBが含まれていました。

マイクロサービスへの今日の傾向では、Javaランタイム環境が小さくて軽量であることは重要です。そのため、可能なすべてのテクノロジーのサポートが組み込まれた大きなランタイムライブラリを使用することは、もはやそれほど有利ではありません。

したがって、Java EEおよびCORBAモジュールをJDKから削除するという提案がJEP-320で行われました。

MOXyに関する注意:jaxp.properties次の行を含みます:

javax.xml.bind.context.factory=org.Eclipse.persistence.jaxb.JAXBContextFactory

問題を取り除くには:

javax.xml.bind.JAXBException:JAXB-APIの実装がモジュールパスまたはクラスパスで見つかりませんでした。

Sunの実装の依存関係を含む、Orbyからのまだきれいに印刷されたコメントのバージョンを追加しました。

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.1</version>
</dependency>
<dependency>
    <groupId>com.Sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.1</version>
</dependency>
<dependency>
    <groupId>com.Sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0</version>
</dependency>
9
pirho