码迷,mamicode.com
首页 > 编程语言 > 详细

java神奇问题汇总

时间:2014-05-08 21:54:58      阅读:430      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   java   ext   color   

com.sun .xml.bind.v2.ContextFactory 类找不到的解决

用cxf+spring发布webservice,使用apache-cxf客户端方式调用接口访问服务器时,报javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found 错误,异常堆栈信息如下:


Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:151)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:299)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at org.apache.cxf.wsdl.JAXBExtensionHelper.createJAXBContext(JAXBExtensionHelper.java:196)
at org.apache.cxf.wsdl.JAXBExtensionHelper.getJAXBContext(JAXBExtensionHelper.java:183)
... 65 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:116)
... 70 more

,纠结了很久,各种办法都尝试了,最后才发现是Jre顺序的问题,解决办法如下:

在启动类路径中, Java EE 5 Library 在 JRE System Library[jdk1.6.0_25] 之前, 调整顺序,将JRE放在前面解决。
    有问题的类路径顺序(eclipse:Run->Run Configrations...):
 
bubuko.com,布布扣
bubuko.com,布布扣
bubuko.com,布布扣
 
 
 
bubuko.com,布布扣
bubuko.com,布布扣

java神奇问题汇总,布布扣,bubuko.com

java神奇问题汇总

标签:style   blog   class   java   ext   color   

原文地址:http://www.cnblogs.com/xiaoqing2013/p/3709173.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!