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 <[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
>
>