解決java.lang.ClassNotFoundException: org.codehaus.xfire.jaxb2.JaxbWSDLBuilderFactory

使用myeclipse生成的webservice客戶端,在新建的java ee的web項目中執行沒有任何問題,將代碼放在現有的web工程的後,出現
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/xfire/jaxb2/JaxbWSDLBuilderFactory
    at org.codehaus.xfire.jaxws.JAXWSServiceFactory.<init>(JAXWSServiceFactory.java:49)
    at org.codehaus.xfire.jaxws.JAXWSHelper.<init>(JAXWSHelper.java:29)
    at org.codehaus.xfire.jaxws.JAXWSHelper.<clinit>(JAXWSHelper.java:38)
    at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java:33)
    at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java:53)
    at org.codehaus.xfire.jaxws.Provider.createServiceDelegate(Provider.java:32)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at com.digitalchina.app.trfvlt.chexingyi.register.ThirdPartyUserCarInforService.<init>(ThirdPartyUserCarInforService.java:51)
    at com.digitalchina.app.trfvlt.chexingyi.test.Test.main(Test.java:21)
Caused by: java.lang.ClassNotFoundException: org.codehaus.xfire.jaxb2.JaxbWSDLBuilderFactory
    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)

    ... 9 more

懷疑是包衝突問題,但是使用myeclipse搜索,真的找不到這個類,估計是少了xfire-all-1.2.6.jar,加上去之後,出現新的異常
Exception in thread "main" java.lang.IllegalStateException: Could not initialize Service.
    at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java:77)
    at org.codehaus.xfire.jaxws.Provider.createServiceDelegate(Provider.java:32)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at com.digitalchina.app.trfvlt.chexingyi.register.ThirdPartyUserCarInforService.<init>(ThirdPartyUserCarInforService.java:51)
    at com.digitalchina.app.trfvlt.chexingyi.test.Test.main(Test.java:21)
Caused by: java.lang.NoSuchMethodException: com.digitalchina.app.trfvlt.chexingyi.register.ThirdPartyUserCarInforService.getPortClassMap()
    at java.lang.Class.getMethod(Class.java:1605)
    at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java:60)
    ... 4 more

真的好奇怪,這次肯定是類衝突了,把項目之前lib的xfire-*全部刪掉,竟然成功啦


發佈了23 篇原創文章 · 獲贊 3 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章