You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Christian Schneider <ch...@die-schneider.net> on 2013/08/05 17:32:46 UTC

Problem with Rest Client in blueprint

I am currently facing some problems using a jaxrs:client in blueprint.

The first problem is that org.apache.cxf.jaxrs.client.Client is not 
found at runtime.
I had to add this to the maven bundle plugin to make it work:
                         <Import-Package>
                             org.apache.cxf.jaxrs.client,
                             *
                         </Import-Package>

As far as I know this should not be necessary. So this might be a bug in 
the cxf blueprint support.

The next and more severe problem is that my service interface is not found:
Caused by: java.lang.IllegalArgumentException: interface 
net.lr.tutorial.karaf.cxf.personservice.person.PersonService is not 
visible from class loader

It looks like the JAXRS client factory does not use the classloader of 
my bundle. My bundle correctly imports the package so it should be visible.

You can easily recreate error using my Karaf cxf tutorial:
Checkout the project https://github.com/cschneider/Karaf-Tutorial

The project you need is at: cxf/personservice
Run mvn clean install there.

Then start karaf 2.3.2 and execute the following commands:
features:chooseurl cxf 2.7.5
features:install http cxf
install -s 
mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-model/1.0-SNAPSHOT
install -s 
mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-server/1.0-SNAPSHOT
install -s 
mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-proxy-rest/1.0-SNAPSHOT

The proxy bundle will be in blueprint status failed and the stacktrace 
will look like this:
https://gist.github.com/cschneider/6156833

Is there anything I am doing wrong or is this really a CXF bug?

Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com



Re: Problem with Rest Client in blueprint

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Christian

Thanks for reporting it,
On 05/08/13 16:32, Christian Schneider wrote:
> I am currently facing some problems using a jaxrs:client in blueprint.
>
> The first problem is that org.apache.cxf.jaxrs.client.Client is not
> found at runtime.
> I had to add this to the maven bundle plugin to make it work:
>                          <Import-Package>
>                              org.apache.cxf.jaxrs.client,
>                              *
>                          </Import-Package>
>
> As far as I know this should not be necessary. So this might be a bug in
> the cxf blueprint support.

I'd like to understand it better: why do you think it may be a bug ?

>
> The next and more severe problem is that my service interface is not found:
> Caused by: java.lang.IllegalArgumentException: interface
> net.lr.tutorial.karaf.cxf.personservice.person.PersonService is not
> visible from class loader
>
> It looks like the JAXRS client factory does not use the classloader of
> my bundle. My bundle correctly imports the package so it should be visible.
>
> You can easily recreate error using my Karaf cxf tutorial:
> Checkout the project https://github.com/cschneider/Karaf-Tutorial
>
> The project you need is at: cxf/personservice
> Run mvn clean install there.
>
> Then start karaf 2.3.2 and execute the following commands:
> features:chooseurl cxf 2.7.5
> features:install http cxf
> install -s
> mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-model/1.0-SNAPSHOT
>
> install -s
> mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-server/1.0-SNAPSHOT
>
> install -s
> mvn:net.lr.tutorial.karaf.cxf.personservice/personservice-proxy-rest/1.0-SNAPSHOT
>
>
> The proxy bundle will be in blueprint status failed and the stacktrace
> will look like this:
> https://gist.github.com/cschneider/6156833
>
> Is there anything I am doing wrong or is this really a CXF bug?

We've seen a couple of issues like this before and we added a 
"classLoader" property to JAXRSClientFactoryBean. A utility 
ProxyClassLoader is shipped in those cases where it may be needed.
Hmm... I'm not sure what may be causing it.
I'm on a day off today (bank holiday) and I'm actually off to the 
airport in 40 mins, just about to commit a minor fix to one of JIRAs.

Lets talk more about it tomorrow,

Thanks, Sergey
>
> Christian
>