camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: CamelServlet & spring issue
Date Tue, 15 Feb 2011 09:49:28 GMT
Hi Charles,

If we want to create a spring context in the OSGi platform, we need to 
leverage the Spring DM to help you look up the schema across the bundles.
Current CamelServlet just create the Spring application with use that.

Maybe you can consider to use the OsgiServletRegisterer which is new 
added by Christian, you can find more information from the JIRA[1].

[1]https://issues.apache.org/jira/browse/CAMEL-3490

Willem

On 2/15/11 5:44 PM, Charles Moulliard wrote:
> camel-spring is deployed on Karaf and referenced as a Require-Bundle
> in the MANIFEST.MF file of my WAR project
>
> The issue is that we cannot import here the camel spring schema as it
> is part of the root of camel-spring jar and not exported by the bundle
> like this is the case by example for camel-cxf
>
> ex :
>
> karaf@root>  packages:exports 1883 = camel-cxf
>      ID Packages
>    1883 org.apache.camel.component.cxf.util
>    1883 org.apache.camel.component.cxf
>    1883 org.apache.camel.component.cxf.spring
>    1883 org.apache.camel.component.cxf.transport.spring
>    1883 org.apache.camel.component.cxf.transport
>    1883 org.apache.camel.component.cxf.converter
>    1883 org.apache.camel.component.cxf.jaxrs
>    1883 org.apache.camel.component.cxf.interceptors
>    1883 org.apache.camel.component.cxf.soap.headers
>    1883 org.apache.camel.component.cxf.cxfbean
>    1883 org.apache.camel.component.cxf.feature
>    1883 META-INF.cxf.camel<--- where the schemas are exported
>
> On Tue, Feb 15, 2011 at 10:33 AM, Sumit Teke
> <sumit_teke@omniscient.co.in>  wrote:
>>   Check if camel-spring is on classpath.
>>
>> Thanks,
>> Sumit Teke
>>
>> On Tuesday 15 February 2011 02:51 PM, Charles Moulliard wrote:
>>>
>>> Hi,
>>>
>>> When deploying a WAR project on Karaf, I get the following error :
>>>
>>> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
>>> Configuration problem: Unable to locate Spring NamespaceHandler for
>>> XML schema namespace [http://camel.apache.org/schema/spring]
>>> Offending resource: class path resource
>>> [META-INF/spring/camel-context.xml]
>>>
>>>         at
>>> org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:284)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1332)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)[48:org.springframework.beans:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)[49:org.springframework.context:3.0.5.RELEASE]
>>>         at
>>> org.apache.camel.component.servlet.CamelHttpTransportServlet.init(CamelHttpTransportServlet.java:46)[1985:org.apache.camel.camel-servlet:2.6.0]
>>>         at
>>> org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:432)[1842:org.eclipse.jetty.servlet:7.2.2.v20101205]
>>>
>>> Spring is not able to find the NameSpaceHandler for XML schema
>>> namespace [http://camel.apache.org/schema/spring] even if canel-core
>>> and camel-spring 2,6,0 are deployed on Karaf and added in the
>>> classpath.
>>>
>>>      <servlet>
>>>          <servlet-name>CamelServlet</servlet-name>
>>>          <display-name>Camel Http Transport Servlet</display-name>
>>>
>>> <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
>>>          <init-param>
>>>              <param-name>contextConfigLocation</param-name>
>>>              <param-value>META-INF/spring/camel-context.xml</param-value>
>>>          </init-param>
>>>      </servlet>
>>>
>>>      <servlet-mapping>
>>>          <servlet-name>CamelServlet</servlet-name>
>>>          <url-pattern>/test/*</url-pattern>
>>>      </servlet-mapping>
>>>
>>> *************************************
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>     xmlns:camel="http://camel.apache.org/schema/spring"
>>>     xsi:schemaLocation="
>>>     http://www.springframework.org/schema/beans
>>>     http://www.springframework.org/schema/beans/spring-beans.xsd
>>>     http://camel.apache.org/schema/spring
>>>     http://camel.apache.org/schema/spring/camel-spring.xsd">
>>>
>>>      <bean id="response"
>>> class="org.apache.camel.example.osgi.ResponseBean"/>
>>>
>>>         <camelContext xmlns="http://camel.apache.org/schema/spring">
>>>          <route id="servlet-service">
>>>              <from uri="servlet:///service"/>
>>>              <bean ref="response"/>
>>>              <log message="Response send to the client !"
>>> loggingLevel="INFO"/>
>>>          </route>
>>>         </camelContext>
>>>
>>> </beans>
>>>
>>>
>>> Any idea is welcome ?
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Mime
View raw message