Using JAX-WS 2.1 with JavaSE6 (NoClassDefFoundError: org/jvnet/staxex/XMLStreamReaderEx)

本文介绍了如何解决在JavaSE6环境下使用JAX-WS2.1 API时出现的NoClassDefFoundError问题。通过将特定的JAR文件放置到JRE的endorsed目录中,可以避免与系统自带的JAX-WS 2.0 API冲突。

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

posted on 2010-03-24 10:01 浙林龙哥 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/huqingyu/archive/2010/03/24/1693479.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值