You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Reilly <jd...@gmail.com> on 2011/11/04 16:09:52 UTC

java.lang.NoSuchFieldError: QUALIFIED

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

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Glen Mazza <gm...@talend.com>.
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<jd...@gmail.com>  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


Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Jason Reilly <jd...@gmail.com>.
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 <jd...@gmail.com> 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
>
>


-- 
Jason Reilly
Software Engineer

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by chandra shekhar <ch...@hotmail.com>.
Hi Jason,

I am a newbie, getting same issue. Can you tell me how you get to the exact
dependency and how did you remove it. I would appreciate if you can provide
all steps, I am having less experience of maven.
I am also using XmlSchema-core of higher version 2.X and receiving same
error

Caused by: java.lang.NoSuchMethodError:
org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;

Regards,
Chandra Shekhar



--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-NoSuchFieldError-QUALIFIED-tp4964380p5730106.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Jason Reilly <jd...@gmail.com>.
Dan,

Thanks for your help.  Seems I have some dependency cleaning to do as I
found a reference to org.apache.axis2:axis2-kernel:1.6.0, which depends on
org.apache.ws.commons.schema:XmlSchema:1.4.7.

Regards,
Jason

On Mon, Nov 7, 2011 at 10:34 AM, Daniel Kulp <dk...@apache.org> wrote:

> On Monday, November 07, 2011 10:14:03 AM Jason Reilly wrote:
> >
> > Yet, when I add your System.out.println() statement for the
> > XmlSchemaCollection.class, I get the following:
> >
> >
> jar:file:/home/jdr0887/.m2/repository/org/apache/ws/commons/schema/XmlSchema
> >
> /1.4.7/XmlSchema-1.4.7.jar!/org/apache/ws/commons/schema/XmlSchemaCollection
> > .class
> >
> > How is this possible?  I have a maven pom with
> > org.apache.ws.xmlschema:xmlschema-core:2.0.1 defined and have imported
> the
> > project into eclipse using mvn eclipse:eclipse.  Running 'mvn
> > dependency:tree' shows no reference to xmlschema-core:1.4.7.  How on
> earth
> > is that jar found?
>
> For 1.4.7, look for just XmlSchema, not xmlschema-core.
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> Talend - http://www.talend.com
>



-- 
Jason Reilly
Software Engineer

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, November 07, 2011 10:14:03 AM Jason Reilly wrote:
> 
> Yet, when I add your System.out.println() statement for the
> XmlSchemaCollection.class, I get the following:
> 
> jar:file:/home/jdr0887/.m2/repository/org/apache/ws/commons/schema/XmlSchema
> /1.4.7/XmlSchema-1.4.7.jar!/org/apache/ws/commons/schema/XmlSchemaCollection
> .class
> 
> How is this possible?  I have a maven pom with
> org.apache.ws.xmlschema:xmlschema-core:2.0.1 defined and have imported the
> project into eclipse using mvn eclipse:eclipse.  Running 'mvn
> dependency:tree' shows no reference to xmlschema-core:1.4.7.  How on earth
> is that jar found?

For 1.4.7, look for just XmlSchema, not xmlschema-core.  

 

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Jason Reilly <jd...@gmail.com>.
Dan,

I have a working client:

QName portQName = new QName("http://<snip> "HelloWorldPort");
String body = "<ns1:findById xmlns:ns1=\"http://
<snip>\"><id>2</id></ns1:findById>\n";
InputStream requestStream = new ByteArrayInputStream(body.getBytes());
Service service = Service.create(new QName("http://<snip>",
"HelloWorldService"));
service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, "
http://localhost:8181/cxf/HelloWorld");
Dispatch<Source> dispatch = service.createDispatch(new QName("http://<snip>",
"HelloWorldPort"), Source.class, Service.Mode.PAYLOAD);
Source request = new StreamSource(requestStream);
Source response = dispatch.invoke(request);
Transformer copier = TransformerFactory.newInstance().newTransformer();
copier.transform(response, new StreamResult(System.out));


Yet, when I add your System.out.println() statement for the
XmlSchemaCollection.class, I get the following:

jar:file:/home/jdr0887/.m2/repository/org/apache/ws/commons/schema/XmlSchema/1.4.7/XmlSchema-1.4.7.jar!/org/apache/ws/commons/schema/XmlSchemaCollection.class

How is this possible?  I have a maven pom with
org.apache.ws.xmlschema:xmlschema-core:2.0.1 defined and have imported the
project into eclipse using mvn eclipse:eclipse.  Running 'mvn
dependency:tree' shows no reference to xmlschema-core:1.4.7.  How on earth
is that jar found?


On Fri, Nov 4, 2011 at 6:28 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> It definite sounds like you're getting an older version of XmlSchema
> picked up
> from somplace.  That's definitely what you'll need to look for.  Prior to
> calling that code, you could TRY something like:
>
>
>
>
> System.out.println(XmlSchemaCollection.class.getResource("XmlSchemaCollection.class"))
>
> to see if it will print the URL out to where that class is being loaded
> from.
> That may help you diagnose what's going on.
>
>
> Dan
>
>
>
> On Friday, November 04, 2011 11:09:52 AM Jason Reilly 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(AbstractDat
> > aBinding.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?
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> Talend - http://www.talend.com
>



-- 
Jason Reilly
Software Engineer

Re: java.lang.NoSuchFieldError: QUALIFIED

Posted by Daniel Kulp <dk...@apache.org>.
It definite sounds like you're getting an older version of XmlSchema picked up 
from somplace.  That's definitely what you'll need to look for.  Prior to 
calling that code, you could TRY something like:



System.out.println(XmlSchemaCollection.class.getResource("XmlSchemaCollection.class"))

to see if it will print the URL out to where that class is being loaded from.  
That may help you diagnose what's going on.


Dan



On Friday, November 04, 2011 11:09:52 AM Jason Reilly 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(AbstractDat
> aBinding.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?
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com