23

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?

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
yegor256
  • 102,010
  • 123
  • 446
  • 597

2 Answers2

29

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>
javamonkey79
  • 17,443
  • 36
  • 114
  • 172
Daniel Kulp
  • 14,447
  • 4
  • 45
  • 37
  • I had a legacy WS using Axis mixed in causing grief, add to it that the axis version has "axis" appended to the group id :( - thanks for this +1 – javamonkey79 Apr 27 '12 at 18:38
2

This dependency is wsdl4j-1.6.2.jar, it probably does not get transitively resolved with the current set of dependencies you have.

Biju Kunjummen
  • 49,138
  • 14
  • 112
  • 125