2.8. Using JAX-WS 2.1 with JavaSE6
FROM:https://jax-ws.dev.java.net/guide/Using_JAX_WS_2_1_with_JavaSE6.html
JavaSE6 ships with JAX-WS 2.0 API in rt.jar, which causes some trouble when you try to run applications that use JAX-WS 2.1 API. This document collects information about how to solve this issue. 2.8.1. Endorsed directory
One way to fix this is to copy jaxws-api.jar and jaxb-api.jar into JRE endorsed directory, which is $JAVA_HOME/lib/endorsed (or $JDK_HOME/jre/lib/endorsed)
Some application containers, such as Glassfish, modifies the location of the endorsed directory to a different place. From inside the JVM, you can check the current location by doing System.out.println(System.getProperty("java.endorsed.dirs"));
Obviously you still need other JAX-WS jars in your classpath.
Please do not put all the jars to the endorsed directory. This makes it impossible for JAX-WS RI to see other classes that it needs for its operation, such as servlet classes on the server-side, or Ant classes in the tool time. As those are not loaded by the bootstrap classloader, you'll get NoClassDefError on servlet/Ant classes.
上面说在把jaxws-api.jar and jaxb-api.jar放到jre\lib\endorsed目录下就行,不要放太多东西。
我是放了jaxb-api.jar和webservices-api-2.0.jar,就可以了,一开始还有webservices-rt.jar,会有NoClassDefFoundError错误。
NoClassDefFoundError: org/jvnet/staxex/XMLStreamReaderEx