简体   繁体   中英

What's wrong with my Apache CXF client?

This is part of my 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>

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?

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

EDIT:

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>

这种依赖关系是wsdl4j-1.6.2.jar,它可能无法使用您拥有的当前依赖关系进行传递解析。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM