I'm currently having problems creating and running a CXF client within
Servicemix 4. I've spent
quite some time reading posts and other information on the Internet, and
while others have
apparently run into a similar problem, I haven't seen anything that's in the
same context as what
I am doing.  What I'm trying to do is to create a Camel component which
among other things invokes an external web service using CXF. Using CXF
alone is not a problem, however, getting all of Servicemix
4/Camel/OSGi/Spring DM working together is not so easy. Perhaps someone can
shed some light on what
I am missing, or point me to a working example of something similar to what
I am doing. I've looked 
through both the Servicemix 4 and CXF examples, but none are close enough to
what I am doing to be
of much help.
 
Let me start with the beans.xml file. It looks like the following:

<beans xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:ctx="http://www.springframework.org/schema/context";
  xmlns:osgi="http://www.springframework.org/schema/osgi";
  xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
  xmlns:camel-osgi="http://camel.apache.org/schema/osgi";
  xmlns:jaxws="http://cxf.apache.org/jaxws";
  xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/osgi
        http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://www.springframework.org/schema/osgi-compendium
       
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://camel.apache.org/schema/osgi
        http://camel.apache.org/schema/osgi/camel-osgi.xsd  
        http://cxf.apache.org/jaxws 
        http://cxf.apache.org/schemas/jaxws.xsd";>

 <!--  I added these in, but they just caused more NamespaceHandler problems
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
 -->

  <bean id="proxyFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
    <property name="serviceClass" value="com.myorg.ports.DEMOPortType"/>
    <property name="address" value="http://localhost:9002/DEMO"/>
  </bean>

  <bean id="client" class="com.myorg.ports.DEMOPortType"
    factory-bean="proxyFactory" factory-method="create"/>
 
  <camel-osgi:camelContext xmlns="http://camel.apache.org/schema/spring";>
     <route>
        <from
uri="demo://route-test-demo?demoEndpointAddress=https://localhost:7443/DEMO";
/>
        <to uri="file:///C:/WSMR/C2GW/test/c2gw-pass" />
     </route>
  </camel-osgi:camelContext>

</beans>


My POM Import-Package are as follows:

        <Import-Package>
                     org.apache.commons.logging,
                             org.apache.commons.digester;version="2.0",
                             org.apache.commons.configuration;version="1.6",
                             org.apache.commons.io;version="1.4",
                             javax.jws.*,
                             javax.xml.*,
                             javax.net.*,
                             javax.wsdl,
                             META-INF.cxf,
                             META-INF.cxf.osgi, 

                             javax.xml.transform,
                     javax.xml.soap,
                                        
                             org.w3c.dom,
                             org.xml.sax,

                             org.apache.camel,
                             org.apache.camel.model,
                             org.apache.camel.spi,
                             org.apache.camel.builder,
                             org.apache.camel.language,
                             org.apache.camel.spring.handler,

                             org.apache.cxf,
                             org.apache.cxf.io,
                             org.apache.cxf.frontend,
                             org.apache.cxf.configuration.jsse,
                             org.apache.cxf.message,
                             org.apache.cxf.helpers,
                             org.apache.cxf.interceptor,
                             org.apache.cxf.binding.soap,
                             org.apache.cxf.binding.soap.interceptor,
                             org.apache.cxf.bus,
                             org.apache.cxf.jaxws,
                             org.apache.cxf.bus.resource,
                             org.apache.cxf.bus.spring,
                             org.apache.cxf.buslifecycle,
                             org.apache.cxf.catalog,
                             org.apache.cxf.configuration.spring,
                             org.apache.cxf.endpoint,
                             org.apache.cxf.headers,
                             org.apache.cxf.phase,
                             org.apache.cxf.resource,
                             org.apache.cxf.transport,
                             org.apache.cxf.transport.http,
                             org.apache.cxf.workqueue,
                             org.apache.cxf.wsdl11,
                             org.apache.cxf.transport.https,
                             org.apache.servicemix.cxf.transport.http_osgi,
                             org.apache.cxf.transport.http_jetty,
                             org.osgi.framework,
                             org.springframework.beans.factory.config,
                             *
                          </Import-Package>


When I start the bundle, I get the following error output on the Karaf
console:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for XML
 schema namespace [http://camel.apache.org/schema/osgi]
Offending resource: class path resource [META-INF/spring/beans.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:281)
        at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1294)
        at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
        at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.jav
a:135)
        at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.
java:92)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
        at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
        at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.jav
a:123)
        at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
                            :
                            :

So, one of the questions is, is the camel-spring-osgi bundle running in
Servicemix?

Here's the output from osgi:list command:

ka...@root> list |grep -i camel
[  98] [Active     ] [            ] [       ] [   60] camel-core
(2.2.0.fuse-01-00)
[ 100] [Active     ] [            ] [       ] [   60] camel-spring-osgi
(2.2.0.fuse-01-00)
[ 130] [Active     ] [            ] [       ] [   60] camel-cxf
(2.2.0.fuse-01-00)
[ 156] [Active     ] [            ] [       ] [   60] camel-jms
(2.2.0.fuse-01-00)
[ 169] [Active     ] [            ] [       ] [   60] ServiceMix :: Camel
(2010.01.0.fuse-01-00)
[ 180] [Active     ] [            ] [       ] [   60] Apache ServiceMix
Camel Component (4.2.0.fuse-01-00)
[ 190] [Active     ] [            ] [       ] [   60] camel-jxpath
(2.2.0.fuse-01-00)
ka...@root>

So, it appears that the camel-spring-osgi bundle is present.
Perhaps I need to include additional Import-Package? But if so, do I need to
do this for
every namespace? As I mentioned earlier when I added the additional imports
into my
beans.xml I get additional errors with reagards to finding
NamespaceHandlers.

I've been working on this for some time now, getting a bit frustrated and
thinking why does it 
need to be so difficult? If anyone has encountered this problem and can
explain to me how to 
correct it, it would be much appreciated. Failing that, if someone has a
working example of a
CXF client/server working in Servicemix 4, that would be appreciated as
well.

Thanks.


-T


-- 
View this message in context: 
http://servicemix.396122.n5.nabble.com/Servicemix-4-CXF-Unable-to-locate-Spring-NamespaceHandler-tp1842459p1842459.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to