You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Guy Pardon <gu...@atomikos.com> on 2011/11/28 19:27:39 UTC

Running CXF REST services in OSGi

Hi,

I am trying to get a REST service deployed in OSGi (Felix). To do so, I tried embedding all depedencies as jars into my bundle, including CXF. 

However, this fails upon start, saying:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxrs]
Offending resource: class path resource [delijn//cxf.xml]

I am aware that OSGi changes the rules a bit for loading stuff from the classpath. 

Question 1: are there any examples on how to make this work?

Question 2: is this a use case for DOSGi/CXF?

Thanks
Guy

Re: Running CXF REST services in OSGi

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 28/11/11 18:27, Guy Pardon wrote:
> Hi,
>
> I am trying to get a REST service deployed in OSGi (Felix). To do so, I tried embedding all depedencies as jars into my bundle, including CXF.
>
> However, this fails upon start, saying:
>
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxrs]
> Offending resource: class path resource [delijn//cxf.xml]
>
> I am aware that OSGi changes the rules a bit for loading stuff from the classpath.
>
> Question 1: are there any examples on how to make this work?
>
I've seen an issue like this once (with pax-web being involved wrapping 
a CXF Servlet on Unix only, Windows was OK), and I recall one of users 
reporting a similar issue when embedding CXF JAX-RS in JBoss.
In the demo I was working upon I resorted to using class names of the 
underlying handlers explicitly, for example, see:

http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesusingexplicitbeanconfiguration

It is not a common approach, just a workaround to some specific 
deployment problems to do with Spring; perhaps using Blueprint may help, 
I need to add some documentation...

> Question 2: is this a use case for DOSGi/CXF?
>

DOSGi is about making sure that an OSGI Service registration leads to an 
endpoint being created under the hood; and the service lookup - to a 
proxy being created. While DOSGi offers its own approach toward working 
with web services in OSGI, the DOSGi CXF distribution is to some extent 
simply a collection of bundles one needs to deploy a regular CXF web 
service in OSGI, so may be it's better not to embed all the libs inside 
a bundle but deploy needed bundles one by one

By the way, have a look at the minimal sample application attached to:
https://issues.apache.org/jira/browse/CXF-3859



Cheers, Sergey

> Thanks
> Guy


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com