jdk9/jdk11/jdk17上运行webservice出错java.lang.NoClassDefFoundError: javax/xml/ws/Endpoint

openjdk9(jdk11/jdk17)以上版本JVM上运行webservice出错java.lang.NoClassDefFoundError: javax/xml/ws/Endpoint,把如下jar包放在tomcat/lib下面解决问题:

jaxb-impl-2.3.2.jar
jaxb-api-2.3.1.jar
jaxws-api-2.3.1.jar
javax.jws-api-1.1.jar
jaxb-core-2.3.0.1.jar
javax.xml.soap-api-1.4.0.jar
activation-1.1.1.jar

具体原因是,jdk9开始,把xml相关的功能从core中剥离出去了,所以,需要自行引用。
需要从maven引用的,参考如下依赖:

<dependency>
  <groupId>javax.xmlgroupId>
  <artifactId>jaxb-implartifactId>
  <version>2.1version>
dependency>
<dependency>
  <groupId>javax.xmlgroupId>
  <artifactId>jaxb-apiartifactId>
  <version>2.1version>
dependency>
<dependency>
  <groupId>javax.xml.wsgroupId>
  <artifactId>jaxws-apiartifactId>
  <version>2.3.1version>
dependency>
<dependency>
  <groupId>javax.jwsgroupId>
  <artifactId>javax.jws-apiartifactId>
  <version>1.1version>
dependency>
<dependency>
  <groupId>com.sun.xml.bindgroupId>
  <artifactId>jaxb-coreartifactId>
  <version>2.3.0.1version>
dependency>
<dependency>
  <groupId>javax.xml.soapgroupId>
  <artifactId>javax.xml.soap-apiartifactId>
  <version>1.4.0version>
dependency>
<dependency>
  <groupId>javax.activationgroupId>
  <artifactId>activationartifactId>
  <version>1.1.1version>
dependency>

你可能感兴趣的:(java,spring-cloud,java,xml,spring,boot)