Hi Christian,

Thanks for your detailed response. I'll try these options and let you know
if there are further issues.

Thanks,
~Isuru

On Wed, Feb 8, 2012 at 9:38 PM, Christian Schneider <[email protected]
> 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
>
>

Reply via email to