【问题标题】:What's wrong with my Apache CXF client?我的 Apache CXF 客户端出了什么问题?
【发布时间】:2011-08-29 07:01:23
【问题描述】:

这是我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 生成的),直到执行:

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)
....

它是关于什么的?我错过了什么依赖?

【问题讨论】:

    标签: java maven jax-ws cxf


    【解决方案1】:

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

    编辑:

    还要注意这个 jar 的 Axis 版本。您可以像这样排除它:

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

    【讨论】:

    • 我有一个旧的 WS 使用 Axis 混合导致悲伤,添加它,轴版本在组 ID 后面附加了“轴”:( - 感谢这个 +1
    • 感谢@DanielKulp,这节省了我的时间。
    【解决方案2】:

    此依赖项是 wsdl4j-1.6.2.jar,它可能无法通过您拥有的当前依赖项集传递解决。

    【讨论】:

      猜你喜欢
      • 2011-09-12
      • 1970-01-01
      • 2011-06-04
      • 2014-12-12
      • 2017-06-13
      • 1970-01-01
      • 1970-01-01
      • 2017-02-18
      • 1970-01-01
      相关资源
      最近更新 更多