使用webservice客户端访问遇到 java: 程序包org.apache.cxf.jaxws不存在 的问题

如果你是Maven项目的话添加pom依赖;

<dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-bundle</artifactId>
      <version>2.7.18</version>
    </dependency>

如不过不是用依赖导入而是lib包形式,就要去下载这个jar包

cxf-bundle-2.7.18.jar library root

 

此处的cxf-bundle版本要与下面的版本号一致,不然会报错,错误信息在下面给大家展示一下 
<!-- 要进行jaxws 服务开发 -->
<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-frontend-jaxws</artifactId>
  <version>2.7.18</version>
</dependency>
<!--内置jetty web服务器 cxf‐rt‐transports‐http‐jetty-->
<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-transports-http-jetty</artifactId>
  <version>2.7.18</version>
</dependency>

 解决办法→org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.createConduit

Exception in thread "main" java.lang.AbstractMethodError: org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.createConduit(Lorg/apache/cxf/transport/http/HTTPTransportFactory;Lorg/apache/cxf/Bus;Lorg/apache/cxf/service/model/EndpointInfo;Lorg/apache/cxf/ws/addressing/EndpointReferenceType;)Lorg/apache/cxf/transport/http/HTTPConduit;
    at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:233)
    at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:226)
    at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:233)
    at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:144)
    at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:108)
    at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
    at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:882)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:526)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)
    at com.sun.proxy.$Proxy37.sayHello(Unknown Source)
    at com.tao.service.Client.main(Client.java:29)

 

posted @ 2021-04-15 22:24  旧歌  阅读(3315)  评论(0编辑  收藏  举报