I had a similar error with WebSphere fixed after I did classloader rearranging. Most probably you'll need to comment out some libraries in Karaf's jre.properties[1] file for the SOAP calls to work. You can also try a commercial wrap of CXF (open source Talend Services Factory) which has a preconfigured Karaf to work OOTB with CXF as well as provides (in a separate download) several tested REST and JAX-WS samples.

HTH,
Glen

[1] http://www.dankulp.com/blog/?p=332

On 11/04/2011 11:36 AM, Jason Reilly wrote:
Got ahead of myself.....

When I change the client code to:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
//factory.setAddress("http://localhost:8181/cxf/HelloWorld";);
factory.setWsdlLocation("http://localhost:8181/cxf/HelloWorld?wsdl";);
HelloWorld client = (HelloWorld) factory.create();
String reply = client.findById(2L);
System.out.println("Server said: " + reply);

I get the following error:

INFO: Creating Service {http://<snippedNamespace>HelloWorldService from
WSDL: http://localhost:8181/cxf/HelloWorld?wsdl
Exception in thread "main" java.lang.NoSuchFieldError: QUALIFIED
     at
org.apache.cxf.service.model.SchemaInfo.setSchema(SchemaInfo.java:146)

Any ideas?


On Fri, Nov 4, 2011 at 11:09 AM, Jason Reilly<[email protected]>  wrote:

Hi all,

I am trying to get web services deployed and successfully callable from a
CXF/Karaf environment.  I have Karaf running and CXF installed and a
HelloWorld service deployed.  My problem is within the client.  I keep
running into errors.  The first error looks like this:

INFO: Creating Service {http://<snipped-namespace>}HelloWorldService from
class<snipped-package>.HelloWorld
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;
     at
org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:130)
     at
org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:177)

There were a number of threads I read up to instruct me to ensure that
XmlSchema Core version 2.0.1 is in my classpath.  In my Maven POM, I have
the following:

     <dependency>
       <groupId>org.ops4j.pax.logging</groupId>
       <artifactId>pax-logging-service</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.ops4j.pax.logging</groupId>
       <artifactId>pax-logging-api</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
       <version>1.1.3</version>
     </dependency>
     <dependency>
       <groupId>javax.xml.bind</groupId>
       <artifactId>jaxb-api</artifactId>
       <version>2.2.5</version>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jaxws_2.2_spec</artifactId>
       <version>1.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.ws.xmlschema</groupId>
       <artifactId>xmlschema-core</artifactId>
       <version>2.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxws</artifactId>
       <version>2.5.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-http</artifactId>
       <version>2.5.0</version>
     </dependency>


The client code snippet is as follows:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
factory.setAddress("http://localhost:8181/HelloWorld?wsdl";);
HelloWorld client = (HelloWorld) factory.create();
String reply = client.findById(2L);
System.out.println("Server said: " + reply);
System.exit(0);

The server side code looks like this:

@WebService()
public class HelloWorld {

     private final Logger log = LoggerFactory.getLogger(HelloWorld.class);

     @WebMethod
     public String findById(@WebParam(name = "id") Long id) {
         log.info("id: " + id);
         return "asdfasdf";
     }

     @WebMethod
     public String findByNameAndInstrument(@WebParam(name = "name") String
name,
             @WebParam(name = "instrument") String instrument) {
         return "qwerqwer";
     }

}

When I request "http://localhost:8181/cxf/HelloWorld/findById";, I am
returned a soap envelope with the body containing "asdfasdf".  This
indicates to me that the server side is fine....just something amiss with
the client.

Any suggestions?


--
Jason Reilly
Software Engineer





--
Glen Mazza
Talend - http://www.talend.com/apache
Blog - http://www.jroller.com/gmazza/
Twitter - glenmazza

Reply via email to