xfire java.lang.IllegalStateException: Could not initialize Service

kingschan 2016-04-07 17:31:56 阅读 954 评论 0 喜欢 0
java webservice 异常 

今天发现一个很奇怪的问题,新建一个空的项目根据wsdl地址生成webservice 客户端代码调用就正常,把它放到lib包中包含xfire-all-1.2.4.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.gaojin.webservice.barCode.client.WmsServiceService.<init>(WmsServiceService.java:52)
at A.main(A.java:20)
Caused by: java.lang.NoSuchMethodException: com.gaojin.webservice.barCode.client.WmsServiceService.getPortClassMap()
at java.lang.Class.getMethod(Class.java:1607)
at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java:60)
... 4 more

后经过测试把xfire-all-1.2.4.jar包删除就正常。那么问题来了,这个包是什么东西影响了项目的正常运行呢?

在网上找了下资料,再结合自己以往的心得。我觉得应该是这样的。

我调用的是jax-ws发布的ws。

而现在项目用是使用xfire发面ws

由于两个提供服务的生产厂商不一样,所以导致某些类冲突了。这是最合理的解释。

在得知这一点后,我马上联想到:

把xfire-all-1.2.6.jar里META-INF/services 目录下的javax.xml.ws.spi.Provider

内容改成com.sun.xml.internal.ws.spi.ProviderImpl

经过修改后,重启服务发现问题解决。


支持@用户名回复

×  

:bowtie: :smile: :laughing: :blush: :smiley: :relaxed: :smirk: :heart_eyes: :kissing_heart: :kissing_closed_eyes: :flushed: :relieved: :satisfied: :grin: :wink: :stuck_out_tongue_winking_eye: :stuck_out_tongue_closed_eyes: :grinning: :kissing: :kissing_smiling_eyes: :stuck_out_tongue: :sleeping: :worried: :frowning: :anguished: :open_mouth: :grimacing: :confused: :hushed: :expressionless: :unamused: :sweat_smile: :sweat: :weary: :pensive: :disappointed: :confounded: :fearful: :cold_sweat: :persevere: :cry: :sob: :joy: :astonished: :scream: :neckbeard: :tired_face: :angry: :rage: :triumph: :sleepy: :yum: :mask: :sunglasses: :dizzy_face: :imp: :smiling_imp: :neutral_face: :no_mouth: :innocent: :alien: :yellow_heart: :blue_heart: :purple_heart: :heart: :green_heart: :broken_heart: :heartbeat: :heartpulse: :two_hearts: :revolving_hearts: :cupid: :sparkling_heart: :sparkles: :star: :star2: :dizzy: :boom: :collision: :anger: :exclamation: :question: :grey_exclamation: :grey_question: :zzz: :dash: :sweat_drops: :notes: :musical_note: :fire: :hankey: :poop: :shit: :+1: :thumbsup: :-1: :thumbsdown: :ok_hand: :punch: :facepunch: :fist: :v: :wave: :hand: :open_hands: :point_up: :point_down: :point_left: :point_right: :raised_hands: :pray: :point_up_2: :clap: :muscle: :metal: :walking: :runner: :running: :couple: :family: :two_men_holding_hands: :two_women_holding_hands: :dancer: :dancers: :ok_woman: :no_good: :information_desk_person: :raised_hand: :bride_with_veil: :person_with_pouting_face: :person_frowning: :bow: :couplekiss: :couple_with_heart: :massage: :haircut: :nail_care: :boy: :girl: :woman: :man: :baby: :older_woman: :older_man: :person_with_blond_hair: :man_with_gua_pi_mao: :man_with_turban: :construction_worker: :cop: :angel: :princess: :smiley_cat: :smile_cat: :heart_eyes_cat: :kissing_cat: :smirk_cat: :scream_cat: :crying_cat_face: :joy_cat: :pouting_cat: :japanese_ogre: :japanese_goblin: :see_no_evil: :hear_no_evil: :speak_no_evil: :guardsman: :skull: :feet: :lips: :kiss: :droplet: :ear: :eyes: :nose: :tongue: :love_letter: :bust_in_silhouette: :busts_in_silhouette: :speech_balloon: :thought_balloon:

共0条评论

相似文章

  • 顶部
  • 关灯
  • 留言
  • 点赞