客户端调用webservice使报 org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.createConduit,解决办法

如果报了:

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean提示类找不到。点击这里→即可解决

服务端可以正常运行,使用url调用也可以正常运行

今天在使用webservice的时候,访问客户端访问服务端报了如下的错:

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)

最后通过更改我们的CXF版本解决了这个问题:,发现是我的这个 cxf pom依赖与cxf-jaxws版本不一致导致的

 <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-bundle</artifactId>
      <version>2.7.18</version>
    </dependency>
一同奉上
<!-- 要进行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>

 

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