J'ai créé une application Spring Boot à l'aide de la version 2.2.0.BUILD-SNAPSHOT avec Java 11 (POM ci-dessous):
<?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>
Lorsque l'application démarre, elle lève cette exception:
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
Cependant, lorsque je supprime la dépendance suivante:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
l'application ne démarre pas:
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
À partir de Java 9 l'implémentation JAXB a été supprimée. Donc, ce que vous avez ajouté n'est que l'API et vous devez également ajouter l'implémentation. Il peut y avoir plusieurs alternatives.
Comme correctif, vous pouvez ajouter - par exemple, car il existe également d'autres implémentations - je suppose - cette dépendance:
<dependency>
<groupId>org.Eclipse.persistence</groupId>
<artifactId>org.Eclipse.persistence.moxy</artifactId>
<version>2.7.3</version>
</dependency>
Ici est une excellente explication à ce sujet.
Pourquoi il a été supprimé (extrait du lien ci-dessus):
La bibliothèque standard de Java n'est pas exactement petite et légère. Au cours des 20 dernières années, de nombreuses fonctionnalités y ont été ajoutées, principalement parce qu'à l'époque, on pensait que ce serait une bonne idée si Java supportait une technologie particulière). prêt à l'emploi.
L'un d'eux était la prise en charge des services Web basés sur XML. Lorsque Java SE 6 est sorti en décembre 2006, les services Web basés sur XML étaient populaires, donc les développeurs du langage Java) ont pensé que ce serait une bonne idée if Java prendrait en charge l'appel de services Web en tant que fonctionnalité standard. Il a été décidé d'ajouter les API nécessaires, qui ont été initialement développées dans le cadre de Java EE , à Java SE. Parmi ceux-ci figuraient JAX-WS (API Java pour les services Web basés sur XML) et JAXB.
Avec la tendance actuelle aux microservices, il est important que l'environnement d'exécution Java Java soit petit et léger, donc avoir une grande bibliothèque d'exécution avec un support intégré pour chaque technologie possible n'est plus aussi avantageux.
Par conséquent, une proposition a été faite dans JEP-320 pour supprimer les modules Java EE et CORBA du JDK.
Remarque sur MOXy: vous devrez peut-être également ajouter jaxp.properties
qui contient une ligne:
javax.xml.bind.context.factory=org.Eclipse.persistence.jaxb.JAXBContextFactory
se débarrasser du problème:
javax.xml.bind.JAXBException: l'implémentation de JAXB-API n'a pas été trouvée sur le chemin du module ou le chemin de classe.
Ajout d'une version imprimée du commentaire d'Orby qui contient des dépendances pour l'implémentation de Sun:
<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>