You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Isuru Suriarachchi <is...@gmail.com> on 2012/03/01 11:03:50 UTC

Re: Getting CXF to work properly in OSGi

Hi Christian,

I could move forward a little bit. But now I'm facing the following issue.

[2012-03-01 15:17:02,983]  INFO
{org.springframework.beans.factory.xml.XmlBeanDefinitionReader} -  Loading
XML bean definitions from URL
[jndi:/localhost/cxf-library/WEB-INF/cxf-servlet.xml]
Mar 1, 2012 3:17:05 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for XML
schema namespace [http://cxf.apache.org/jaxws]
Offending resource: URL
[jndi:/localhost/cxf-library/WEB-INF/cxf-servlet.xml]
at
org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at
org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at
org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)

So it looks like spring framework has not been able to
load org.apache.cxf.jaxws.spring.NamespaceHandler class or it doesn't see
the spring.handlers file. But my cxf bundle has the spring.handlers file in
META-INF and it has the org.apache.cxf.jaxws.spring.NamespaceHandler class
as well.

Do you have any idea about whats going on here?

Actually we are trying to include CXF in our existing Equinox environment.
Therefore moving to some other OSGi container is not an option for us. I
tried to download the Talend Services Factory from [1]. But looks like it's
no longer there. Do I have to download Talend ESB?

Thanks,
~Isuru

[1] http://www.talend.com/download.php

On Wed, Feb 8, 2012 at 9:38 PM, Christian Schneider <chris@die-schneider.net
> wrote:

> CXF works very well in OSGi. Making it work together with spring is a
> little harder as spring dm has very bad classloading but that also works.
>
> First of all you should check if you can use Karaf as your container. It
> also can work with equinox so it should not be a big change for you.
> Karaf allows to install cxf in a very simple way and is the best way to
> get cxf to work in osgi.
>
> You can take a look at the Talend Service factory examples:
> https://github.com/Talend/tsf
>
> Basically Talend Service Factory is Karaf+Equinox+CXF. So that should be
> quite nearto what you have.
>
> The key to make spring work with cxf in OSGi is to define the correct
> import or require bundle statements. For CXF < 2.6.0 there is only a single
> CXF bundle so it is easiest to do
> require bundle on it.
>
> This will import among other things the META-INF/cxf package. So the
> cxf.xml will be found. Btw. in current CXF versions you only need cxf.xml.
> The other imports are not necessary anymore.
>
> The best way to work with cxf in OSGi though is to use aries blueprint
> instead of cxf. It has much better classloading. So when you use maven and
> the bundle plugin to create your bundles you normally do not need to define
> imports manually when using blueprint. This makes using OSGi almost as
> simple as plain java.
>
> I wrote a Tutorial for CXF on Karaf with blueprint some time ago:
> http://www.liquid-reality.de/**display/liquid/2011/12/22/**
> Karaf+Tutorial+Part+4+-+CXF+**Services+in+OSGi<http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi>
>
> The examples are on github and are really simple:
> https://github.com/cschneider/**Karaf-Tutorial/tree/master/**
> cxf/personservice<https://github.com/cschneider/Karaf-Tutorial/tree/master/cxf/personservice>
>
> Christian
>
>
> Am 08.02.2012 15:45, schrieb Isuru Suriarachchi:
>
>  Hi all,
>>
>> I'm trying to bring CXF into my OSGi container (equinox). So the spring
>> framework is a single bundle and cxf is a separate bundle. And my web.xml
>> has the following context param.
>>
>> <context-param>
>>     <param-name>**contextConfigLocation</param-**name>
>>     <param-value>
>>       classpath:META-INF/cxf/cxf.xml
>>       classpath:META-INF/cxf/cxf-**extension-soap.xml
>>       classpath:META-INF/cxf/cxf-**servlet.xml
>>      </param-value>
>>   </context-param>
>>
>> But when I try to deploy this, I get the following exception.
>>
>> SEVERE: Exception sending context initialized event to listener instance
>> of
>> class org.springframework.web.**context.ContextLoaderListener
>> org.springframework.beans.**factory.**BeanDefinitionStoreException:
>> IOException
>> parsing XML document from class path resource [META-INF/cxf/cxf.xml];
>> nested exception is java.io.FileNotFoundException: class path resource
>> [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
>>         at
>> org.springframework.beans.**factory.xml.**XmlBeanDefinitionReader.**
>> loadBeanDefinitions(**XmlBeanDefinitionReader.java:**341)
>>         at
>> org.springframework.beans.**factory.xml.**XmlBeanDefinitionReader.**
>> loadBeanDefinitions(**XmlBeanDefinitionReader.java:**302)
>>         at
>> org.springframework.beans.**factory.support.**
>> AbstractBeanDefinitionReader.**loadBeanDefinitions(**
>> AbstractBeanDefinitionReader.**java:143)
>>         at
>> org.springframework.beans.**factory.support.**
>> AbstractBeanDefinitionReader.**loadBeanDefinitions(**
>> AbstractBeanDefinitionReader.**java:178)
>>
>> So it looks like the spring framework can't see the cxf.xml which is in
>> the
>> CXF bundle. Is there a way to overcome this issue? Have anyone tried to
>> use
>> CXF within OSGi?
>>
>> Thanks,
>> ~Isuru
>>
>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>

Re: Getting CXF to work properly in OSGi

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 02/03/12 15:16, Christian Schneider wrote:
> Am 02.03.2012 15:02, schrieb Isuru Suriarachchi:
>> Hi Christian,
>>
>> Thanks for your directions and I tried your sample in Karaf. So it looks
>> like your service is also implemented as an OSGi bundle and the
>> context is
>> loaded through blueprint. So the normal war deployment for CXF
>> services is
>> not possible there.
>>
>> Actually my scenario is little different. We've created our own server
>> using equinox and it has OSGified Tomcat in it. I have CXF and Spring as
>> two separate bundles in the OSGi environment. Our OSGified Tomcat is
>> capable of deploying webapps when the .war file is copied into a
>> particular
>> directory. So the webapp is not deployed as an OSGi bundle.
>>
>> Now I'm trying to support CXF services coming from webapps. Of course we
>> can put all CXF and spring jars in the WEB-INF/lib and get it to work.
>> But
>> I'm trying to use the CXF and spring bundles which are already in the
>> OSGi
>> environment. So the Tomcat bundle gets wired up with CXF and spring
>> bundles
>> and the webapp uses those through the Tomcat bundle.
>>
>> So I can't use blueprint as my webapp is not an OSGi bundle. Do you think
>> my scenario is possible?
> I am not sure if that is possible I do not have much experience in war
> deployment inside OSGi.
>
> In Karaf it is also possible to deploy .wab files these are .war files
> with an OSGi manifest. So that might also
> work for you. It may even be possible to deploy .war files in karaf. At
> least there is a war feature but I have not
> tested if it works with plain war files.
>
> In any case it might be worth a try if you can replace your own server
> with karaf as it would surely safe a lot of work if you
> do not have to maintain your own platform.
>>

what also worked for me was creating a war bundle and deploying it as a 
war bundle,
https://github.com/Talend/tsf/tree/master/examples/jaxrs-jaxws-transformations/war-bundle

>> However I tried your service on our service just to check whether it
>> works
>> that way. First I installed blueprint bundles on our OSGi environment and
>> then installed your service bundles. All bundles got activated and there
>> are no errors on the console. But I'm not sure whether the
>> blueprint.xml is
>> properly read and the service is registered. Is there a way to check
>> that?
> In Karaf you can use the list command which also reports if blueprint
> and spring dm contexts are activated properly.
> Besides that you should see in the log when CXF starts.
>
> Christian
>

Cheers, Sergey

Re: Getting CXF to work properly in OSGi

Posted by Christian Schneider <ch...@die-schneider.net>.
Am 02.03.2012 15:02, schrieb Isuru Suriarachchi:
> Hi Christian,
>
> Thanks for your directions and I tried your sample in Karaf. So it looks
> like your service is also implemented as an OSGi bundle and the context is
> loaded through blueprint. So the normal war deployment for CXF services is
> not possible there.
>
> Actually my scenario is little different. We've created our own server
> using equinox and it has OSGified Tomcat in it. I have CXF and Spring as
> two separate bundles in the OSGi environment. Our OSGified Tomcat is
> capable of deploying webapps when the .war file is copied into a particular
> directory. So the webapp is not deployed as an OSGi bundle.
>
> Now I'm trying to support CXF services coming from webapps. Of course we
> can put all CXF and spring jars in the WEB-INF/lib and get it to work. But
> I'm trying to use the CXF and spring bundles which are already in the OSGi
> environment. So the Tomcat bundle gets wired up with CXF and spring bundles
> and the webapp uses those through the Tomcat bundle.
>
> So I can't use blueprint as my webapp is not an OSGi bundle. Do you think
> my scenario is possible?
I am not sure if that is possible I do not have much experience in war 
deployment inside OSGi.

In Karaf it is also possible to deploy .wab files these are .war files 
with an OSGi manifest. So that might also
work for you. It may even be possible to deploy .war files in karaf. At 
least there is a war feature but I have not
tested if it works with plain war files.

In any case it might be worth a try if you can replace your own server 
with karaf as it would surely safe a lot of work if you
do not have to maintain your own platform.
>
> However I tried your service on our service just to check whether it works
> that way. First I installed blueprint bundles on our OSGi environment and
> then installed your service bundles. All bundles got activated and there
> are no errors on the console. But I'm not sure whether the blueprint.xml is
> properly read and the service is registered. Is there a way to check that?
In Karaf you can use the list command which also reports if blueprint 
and spring dm contexts are activated properly.
Besides that you should see in the log when CXF starts.

Christian

-- 

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

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Getting CXF to work properly in OSGi

Posted by Isuru Suriarachchi <is...@gmail.com>.
Hi Christian,

Thanks for your directions and I tried your sample in Karaf. So it looks
like your service is also implemented as an OSGi bundle and the context is
loaded through blueprint. So the normal war deployment for CXF services is
not possible there.

Actually my scenario is little different. We've created our own server
using equinox and it has OSGified Tomcat in it. I have CXF and Spring as
two separate bundles in the OSGi environment. Our OSGified Tomcat is
capable of deploying webapps when the .war file is copied into a particular
directory. So the webapp is not deployed as an OSGi bundle.

Now I'm trying to support CXF services coming from webapps. Of course we
can put all CXF and spring jars in the WEB-INF/lib and get it to work. But
I'm trying to use the CXF and spring bundles which are already in the OSGi
environment. So the Tomcat bundle gets wired up with CXF and spring bundles
and the webapp uses those through the Tomcat bundle.

So I can't use blueprint as my webapp is not an OSGi bundle. Do you think
my scenario is possible?

However I tried your service on our service just to check whether it works
that way. First I installed blueprint bundles on our OSGi environment and
then installed your service bundles. All bundles got activated and there
are no errors on the console. But I'm not sure whether the blueprint.xml is
properly read and the service is registered. Is there a way to check that?

Thanks,
~Isuru


On Thu, Mar 1, 2012 at 5:07 PM, Christian Schneider <chris@die-schneider.net
> wrote:

> Hi Isuru,
>
> why are you loading the app context from jndi? In an OSGi environment you
> should either use spring dm orr blueprint for that.
> So you simply put your xml in either META-INF/spring or META-INF/blueprint
> and the respective stack picks it up.
>
> Can you provide your whole project? Or even better a small project that
> also shows your problem?
>
> Have a look at http://www.liquid-reality.de/**display/liquid/2011/12/22/**
> Karaf+Tutorial+Part+4+-+CXF+**Services+in+OSGi<http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi>
> for a small example. This example works in Karaf but should also work in
> plain equinox if you install all necessary bundles.
>
> Still you should first try with Karaf as it will be easiest to get
> working. Then you can check which bundles karaf uses and
> use the same in pure equinox.
>
> Talend Service Factory is not available anymore as it was too similar to
> TESB and TIF to manage them separately. So you can use TESB but Karaf will
> also do fine and is much smaller.
> My article above describes how to setup karaf for CXF. It should be a
> matter of less than 10 mins to get the example working. Then you can start
> from this to make your project work too.
>
> Christian
>
>
> Am 01.03.2012 11:03, schrieb Isuru Suriarachchi:
>
>> Hi Christian,
>>
>> I could move forward a little bit. But now I'm facing the following issue.
>>
>> [2012-03-01 15:17:02,983]  INFO
>> {org.springframework.beans.**factory.xml.**XmlBeanDefinitionReader} -
>>  Loading
>> XML bean definitions from URL
>> [jndi:/localhost/cxf-library/**WEB-INF/cxf-servlet.xml]
>> Mar 1, 2012 3:17:05 PM org.apache.catalina.core.**ApplicationContext log
>> SEVERE: StandardWrapper.Throwable
>> org.springframework.beans.**factory.parsing.**
>> BeanDefinitionParsingException**:
>> Configuration problem: Unable to locate Spring NamespaceHandler for XML
>> schema namespace [http://cxf.apache.org/jaxws]
>> Offending resource: URL
>> [jndi:/localhost/cxf-library/**WEB-INF/cxf-servlet.xml]
>> at
>> org.springframework.beans.**factory.parsing.**
>> FailFastProblemReporter.error(**FailFastProblemReporter.java:**68)
>> at
>> org.springframework.beans.**factory.parsing.ReaderContext.**
>> error(ReaderContext.java:85)
>> at
>> org.springframework.beans.**factory.parsing.ReaderContext.**
>> error(ReaderContext.java:80)
>> at
>> org.springframework.beans.**factory.xml.**BeanDefinitionParserDelegate.**
>> error(**BeanDefinitionParserDelegate.**java:316)
>> at
>> org.springframework.beans.**factory.xml.**BeanDefinitionParserDelegate.**
>> parseCustomElement(**BeanDefinitionParserDelegate.**java:1416)
>> at
>> org.springframework.beans.**factory.xml.**BeanDefinitionParserDelegate.**
>> parseCustomElement(**BeanDefinitionParserDelegate.**java:1409)
>>
>> So it looks like spring framework has not been able to
>> load org.apache.cxf.jaxws.spring.**NamespaceHandler class or it doesn't
>> see
>> the spring.handlers file. But my cxf bundle has the spring.handlers file
>> in
>> META-INF and it has the org.apache.cxf.jaxws.spring.**NamespaceHandler
>> class
>> as well.
>>
>> Do you have any idea about whats going on here?
>>
>> Actually we are trying to include CXF in our existing Equinox environment.
>> Therefore moving to some other OSGi container is not an option for us. I
>> tried to download the Talend Services Factory from [1]. But looks like
>> it's
>> no longer there. Do I have to download Talend ESB?
>>
>> Thanks,
>> ~Isuru
>>
>> [1] http://www.talend.com/**download.php<http://www.talend.com/download.php>
>>
>> On Wed, Feb 8, 2012 at 9:38 PM, Christian Schneider<chris@die-schneider.*
>> *net <ch...@die-schneider.net>
>>
>>> wrote:
>>> CXF works very well in OSGi. Making it work together with spring is a
>>> little harder as spring dm has very bad classloading but that also works.
>>>
>>> First of all you should check if you can use Karaf as your container. It
>>> also can work with equinox so it should not be a big change for you.
>>> Karaf allows to install cxf in a very simple way and is the best way to
>>> get cxf to work in osgi.
>>>
>>> You can take a look at the Talend Service factory examples:
>>> https://github.com/Talend/tsf
>>>
>>> Basically Talend Service Factory is Karaf+Equinox+CXF. So that should be
>>> quite nearto what you have.
>>>
>>> The key to make spring work with cxf in OSGi is to define the correct
>>> import or require bundle statements. For CXF<  2.6.0 there is only a
>>> single
>>> CXF bundle so it is easiest to do
>>> require bundle on it.
>>>
>>> This will import among other things the META-INF/cxf package. So the
>>> cxf.xml will be found. Btw. in current CXF versions you only need
>>> cxf.xml.
>>> The other imports are not necessary anymore.
>>>
>>> The best way to work with cxf in OSGi though is to use aries blueprint
>>> instead of cxf. It has much better classloading. So when you use maven
>>> and
>>> the bundle plugin to create your bundles you normally do not need to
>>> define
>>> imports manually when using blueprint. This makes using OSGi almost as
>>> simple as plain java.
>>>
>>> I wrote a Tutorial for CXF on Karaf with blueprint some time ago:
>>> http://www.liquid-reality.de/****display/liquid/2011/12/22/**<http://www.liquid-reality.de/**display/liquid/2011/12/22/**>
>>> Karaf+Tutorial+Part+4+-+CXF+****Services+in+OSGi<http://www.**
>>> liquid-reality.de/display/**liquid/2011/12/22/Karaf+**
>>> Tutorial+Part+4+-+CXF+**Services+in+OSGi<http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi>
>>> >
>>>
>>>
>>> The examples are on github and are really simple:
>>> https://github.com/cschneider/****Karaf-Tutorial/tree/master/****<https://github.com/cschneider/**Karaf-Tutorial/tree/master/**>
>>> cxf/personservice<https://**github.com/cschneider/Karaf-**
>>> Tutorial/tree/master/cxf/**personservice<https://github.com/cschneider/Karaf-Tutorial/tree/master/cxf/personservice>
>>> >
>>>
>>>
>>> Christian
>>>
>>>
>>> Am 08.02.2012 15:45, schrieb Isuru Suriarachchi:
>>>
>>>  Hi all,
>>>
>>>> I'm trying to bring CXF into my OSGi container (equinox). So the spring
>>>> framework is a single bundle and cxf is a separate bundle. And my
>>>> web.xml
>>>> has the following context param.
>>>>
>>>> <context-param>
>>>>     <param-name>****contextConfigLocation</param-****name>
>>>>     <param-value>
>>>>       classpath:META-INF/cxf/cxf.xml
>>>>       classpath:META-INF/cxf/cxf-****extension-soap.xml
>>>>       classpath:META-INF/cxf/cxf-****servlet.xml
>>>>
>>>>      </param-value>
>>>>   </context-param>
>>>>
>>>> But when I try to deploy this, I get the following exception.
>>>>
>>>> SEVERE: Exception sending context initialized event to listener instance
>>>> of
>>>> class org.springframework.web.****context.ContextLoaderListener
>>>> org.springframework.beans.****factory.****BeanDefinitionStoreException:
>>>>
>>>> IOException
>>>> parsing XML document from class path resource [META-INF/cxf/cxf.xml];
>>>> nested exception is java.io.FileNotFoundException: class path resource
>>>> [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
>>>>         at
>>>> org.springframework.beans.****factory.xml.****
>>>> XmlBeanDefinitionReader.**
>>>> loadBeanDefinitions(****XmlBeanDefinitionReader.java:****341)
>>>>         at
>>>> org.springframework.beans.****factory.xml.****
>>>> XmlBeanDefinitionReader.**
>>>> loadBeanDefinitions(****XmlBeanDefinitionReader.java:****302)
>>>>         at
>>>> org.springframework.beans.****factory.support.**
>>>> AbstractBeanDefinitionReader.****loadBeanDefinitions(**
>>>> AbstractBeanDefinitionReader.****java:143)
>>>>         at
>>>> org.springframework.beans.****factory.support.**
>>>> AbstractBeanDefinitionReader.****loadBeanDefinitions(**
>>>> AbstractBeanDefinitionReader.****java:178)
>>>>
>>>>
>>>> So it looks like the spring framework can't see the cxf.xml which is in
>>>> the
>>>> CXF bundle. Is there a way to overcome this issue? Have anyone tried to
>>>> use
>>>> CXF within OSGi?
>>>>
>>>> Thanks,
>>>> ~Isuru
>>>>
>>>>
>>>>  --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Open Source Architect
>>> Talend Application Integration Division http://www.talend.com
>>>
>>>
>>>
>
> --
>
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>

Re: Getting CXF to work properly in OSGi

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Isuru,

why are you loading the app context from jndi? In an OSGi environment 
you should either use spring dm orr blueprint for that.
So you simply put your xml in either META-INF/spring or 
META-INF/blueprint and the respective stack picks it up.

Can you provide your whole project? Or even better a small project that 
also shows your problem?

Have a look at 
http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi
for a small example. This example works in Karaf but should also work in 
plain equinox if you install all necessary bundles.

Still you should first try with Karaf as it will be easiest to get 
working. Then you can check which bundles karaf uses and
use the same in pure equinox.

Talend Service Factory is not available anymore as it was too similar to 
TESB and TIF to manage them separately. So you can use TESB but Karaf 
will also do fine and is much smaller.
My article above describes how to setup karaf for CXF. It should be a 
matter of less than 10 mins to get the example working. Then you can 
start from this to make your project work too.

Christian


Am 01.03.2012 11:03, schrieb Isuru Suriarachchi:
> Hi Christian,
>
> I could move forward a little bit. But now I'm facing the following issue.
>
> [2012-03-01 15:17:02,983]  INFO
> {org.springframework.beans.factory.xml.XmlBeanDefinitionReader} -  Loading
> XML bean definitions from URL
> [jndi:/localhost/cxf-library/WEB-INF/cxf-servlet.xml]
> Mar 1, 2012 3:17:05 PM org.apache.catalina.core.ApplicationContext log
> SEVERE: StandardWrapper.Throwable
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Unable to locate Spring NamespaceHandler for XML
> schema namespace [http://cxf.apache.org/jaxws]
> Offending resource: URL
> [jndi:/localhost/cxf-library/WEB-INF/cxf-servlet.xml]
> at
> org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
> at
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
> at
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
> at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316)
> at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416)
> at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
>
> So it looks like spring framework has not been able to
> load org.apache.cxf.jaxws.spring.NamespaceHandler class or it doesn't see
> the spring.handlers file. But my cxf bundle has the spring.handlers file in
> META-INF and it has the org.apache.cxf.jaxws.spring.NamespaceHandler class
> as well.
>
> Do you have any idea about whats going on here?
>
> Actually we are trying to include CXF in our existing Equinox environment.
> Therefore moving to some other OSGi container is not an option for us. I
> tried to download the Talend Services Factory from [1]. But looks like it's
> no longer there. Do I have to download Talend ESB?
>
> Thanks,
> ~Isuru
>
> [1] http://www.talend.com/download.php
>
> On Wed, Feb 8, 2012 at 9:38 PM, Christian Schneider<chris@die-schneider.net
>> wrote:
>> CXF works very well in OSGi. Making it work together with spring is a
>> little harder as spring dm has very bad classloading but that also works.
>>
>> First of all you should check if you can use Karaf as your container. It
>> also can work with equinox so it should not be a big change for you.
>> Karaf allows to install cxf in a very simple way and is the best way to
>> get cxf to work in osgi.
>>
>> You can take a look at the Talend Service factory examples:
>> https://github.com/Talend/tsf
>>
>> Basically Talend Service Factory is Karaf+Equinox+CXF. So that should be
>> quite nearto what you have.
>>
>> The key to make spring work with cxf in OSGi is to define the correct
>> import or require bundle statements. For CXF<  2.6.0 there is only a single
>> CXF bundle so it is easiest to do
>> require bundle on it.
>>
>> This will import among other things the META-INF/cxf package. So the
>> cxf.xml will be found. Btw. in current CXF versions you only need cxf.xml.
>> The other imports are not necessary anymore.
>>
>> The best way to work with cxf in OSGi though is to use aries blueprint
>> instead of cxf. It has much better classloading. So when you use maven and
>> the bundle plugin to create your bundles you normally do not need to define
>> imports manually when using blueprint. This makes using OSGi almost as
>> simple as plain java.
>>
>> I wrote a Tutorial for CXF on Karaf with blueprint some time ago:
>> http://www.liquid-reality.de/**display/liquid/2011/12/22/**
>> Karaf+Tutorial+Part+4+-+CXF+**Services+in+OSGi<http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi>
>>
>> The examples are on github and are really simple:
>> https://github.com/cschneider/**Karaf-Tutorial/tree/master/**
>> cxf/personservice<https://github.com/cschneider/Karaf-Tutorial/tree/master/cxf/personservice>
>>
>> Christian
>>
>>
>> Am 08.02.2012 15:45, schrieb Isuru Suriarachchi:
>>
>>   Hi all,
>>> I'm trying to bring CXF into my OSGi container (equinox). So the spring
>>> framework is a single bundle and cxf is a separate bundle. And my web.xml
>>> has the following context param.
>>>
>>> <context-param>
>>>      <param-name>**contextConfigLocation</param-**name>
>>>      <param-value>
>>>        classpath:META-INF/cxf/cxf.xml
>>>        classpath:META-INF/cxf/cxf-**extension-soap.xml
>>>        classpath:META-INF/cxf/cxf-**servlet.xml
>>>       </param-value>
>>>    </context-param>
>>>
>>> But when I try to deploy this, I get the following exception.
>>>
>>> SEVERE: Exception sending context initialized event to listener instance
>>> of
>>> class org.springframework.web.**context.ContextLoaderListener
>>> org.springframework.beans.**factory.**BeanDefinitionStoreException:
>>> IOException
>>> parsing XML document from class path resource [META-INF/cxf/cxf.xml];
>>> nested exception is java.io.FileNotFoundException: class path resource
>>> [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
>>>          at
>>> org.springframework.beans.**factory.xml.**XmlBeanDefinitionReader.**
>>> loadBeanDefinitions(**XmlBeanDefinitionReader.java:**341)
>>>          at
>>> org.springframework.beans.**factory.xml.**XmlBeanDefinitionReader.**
>>> loadBeanDefinitions(**XmlBeanDefinitionReader.java:**302)
>>>          at
>>> org.springframework.beans.**factory.support.**
>>> AbstractBeanDefinitionReader.**loadBeanDefinitions(**
>>> AbstractBeanDefinitionReader.**java:143)
>>>          at
>>> org.springframework.beans.**factory.support.**
>>> AbstractBeanDefinitionReader.**loadBeanDefinitions(**
>>> AbstractBeanDefinitionReader.**java:178)
>>>
>>> So it looks like the spring framework can't see the cxf.xml which is in
>>> the
>>> CXF bundle. Is there a way to overcome this issue? Have anyone tried to
>>> use
>>> CXF within OSGi?
>>>
>>> Thanks,
>>> ~Isuru
>>>
>>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> Talend Application Integration Division http://www.talend.com
>>
>>


-- 

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

Open Source Architect
Talend Application Integration Division http://www.talend.com