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?
According to the JAX-WS spec, the client proxies are NOT thread safe. To write portable code, you should treat them as non-thread safe and synchronize access or use a pool of instances or similar. CXF answer: CXF proxies are thread safe for MANY use cases.
Apache CXF™ is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI.
The main differences between axis2 web service and CXF web service are as follows: CXF has support for WS-Addressing, WS-Policy, WS-RM, WS-Security, and WS-I BasicProfile. Axis2 supports each of these except for WS-Policy, which will be supported in an upcoming version.
Apache CXF is the product of two projects, Celtix and XFire , hence the name CXF . Celtix , an open source Java-based Enterprise Service Bus (ESB) project, is a product of ObjectWeb consortia that delivers open source middleware solutions.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With