I am trying to use Apache CXF to talk to a unknown web service. I have followed the Dynamic Client example from Apache.
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
Client client = factory.createClient(wsdlURL.toExternalForm(), SERVICE_NAME);
This was working but now i am getting this exception when calling createClient():
java.lang.IllegalStateException: Unable to create schema compiler
Caused by:
javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC]
This looks similar to an existing bug. I am using DOSGi singlebundle 1.2 which includes cxf-minimal-2.2.9.jar; meaning the bug should be fixed in the version I'm using. the jaxb-api is included in my Apache CXF distribution which upon inspection contains jaxb-xjc.
Can anybody provide me some insight as to what I'm doing wrong? I swear this used to work.
Maven is used to integrate your generated Java CXF client code into an application development and deployment process. By setting up the pom. xml file, Maven can automatically generate the Java CXF client. Alternatively, you can directly use the WebClient APIs to develop a Java CXF client.
To create a client you used ClientProxyFactoryBean class from CXF library. In the WSDL-First approach, you used Endpoint class to publish the service at the desired URL and a specified implementor. You can now extend these techniques to integrate different protocols and transports.
CXF includes a Client interface which allows you to invoke operations and pass parameters for those operations. For instance: Client client = ....; Object[] result = client. invoke( "sayHi" , "Dan" );
wsdl2java takes a WSDL document and generates fully annotated Java code from which to implement a service. The WSDL document must have a valid portType element, but it does not need to contain a binding element or a service element.
"java.lang.ClassNotFoundException: com/sun/tools/ " is often occurs if you use JRE in your IDE intead of JDK. Make sure, you use JDK in IDE (e.g. eclipse)
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.11</version>
</dependency>
resolved problem
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