本文介绍了我的Apache CXF客户端出了什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 pom.xml 的一部分:

<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-frontend-jaxws</artifactId>
  <version>${cxf.version}</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-transports-http</artifactId>
  <version>${cxf.version}</version>
  <scope>runtime</scope>
</dependency>

我正在尝试使用Apache CXF作为JAX-WS的实现。一切正常(Java代码是通过 org.apache.cxf:cxf-codegen-plugin:2.4.0 从WSDL生成的),直到执行:

I'm trying to use Apache CXF as an implementation of JAX-WS. Everything works fine (Java code is generated from WSDL by means of org.apache.cxf:cxf-codegen-plugin:2.4.0), until execution:

java.lang.NoSuchMethodError:
javax.wsdl.xml.WSDLReader.readWSDL(Ljavax/wsdl/xml/WSDLLocator;Lorg/w3c/dom/Element;)Ljavax/wsdl/Definition;
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:237)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
at javax.xml.ws.Service.<init>(Service.java:56)
....

这是什么意思?我错过了什么依赖?

What is it about? What dependency did I miss?

推荐答案

您可能有来自其他地方的1.5(或更旧)版本的wsdl4j。 CXF需要1.6.x版本。

You likely have a 1.5 (or older) version of wsdl4j coming from someplace else. CXF requires the 1.6.x versions.

编辑:

也可以寻找这个罐子的Axis版本。你可以这样排除它:

Also be on the lookout for the Axis version of this jar. You can exclude it like so:

        <exclusions>
            <exclusion>
                <artifactId>axis-wsdl4j</artifactId>
                <groupId>axis</groupId>
            </exclusion>
        </exclusions>

这篇关于我的Apache CXF客户端出了什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 16:02