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: Camel-OSGI and namespaces
Date Tue, 10 Nov 2009 11:57:25 GMT
Hi Charles,

The right Camel context should be
         <!-- Camel context -->	
	<camel:camelContext id="common" trace="false">

		<camel:jmxAgent id="agent" createConnector="false"/>

         </camel:camelContext>

If you don't want to add the namespace prefix you need to define the 
default namespace at root element like this
         <!-- Camel context -->	
	<camelContext id="common" trace="false" 
xmlns="http://camel.apache.org/schema/spring">

		<jmxAgent id="agent" createConnector="false"/>

         </camelContext>

Willem

Charles Moulliard wrote:
> When Spring DSL is used to define camelContext, route, ... in an OSGI
> bundle, the following namespaces and schema location must be used :
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/osgi"
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
>        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>        http://camel.apache.org/schema/osgi
>        http://camel.apache.org/schema/osgi/camel-osgi.xsd
>     ">
> 
> For info, the camel-osgi.xsd schema imports well camel-spring.xsd
> 
> <xs:schema elementFormDefault="qualified" version="1.0"
>            targetNamespace="http://camel.apache.org/schema/osgi"
>            xmlns:tns="http://camel.apache.org/schema/osgi"
>            xmlns:camel="http://camel.apache.org/schema/spring"
>            xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 
>   <xs:import namespace="http://camel.apache.org/schema/spring"
>              schemaLocation="http://camel.apache.org/schema/spring/camel-spring.xsd"
> />
> 
> 
> What is going wrong is that when the camelContext is defined like this
> 
> 	<!-- Camel context -->	
> 	<camel:camelContext id="common" trace="false">
> 
> 		<jmxAgent id="agent" createConnector="false"/>
> 
>         </camel:camelContext>
> 
> the XML parser generates this error
> 
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
> Invalid content was found starting with element 'camel:jmxAgent'. One
> of '{"http://camel.apache.org/schema/spring":properties,
> "http://camel.apache.org/schema/spring":package,
> "http://camel.apache.org/schema/spring":packageScan,
> "http://camel.apache.org/schema/spring":jmxAgent,
> "http://camel.apache.org/schema/spring":beanPostProcessor,
> "http://camel.apache.org/schema/spring":template,
> "http://camel.apache.org/schema/spring":consumerTemplate,
> "http://camel.apache.org/schema/spring":proxy,
> "http://camel.apache.org/schema/spring":export,
> "http://camel.apache.org/schema/spring":routeBuilder,
> "http://camel.apache.org/schema/spring":endpoint,
> "http://camel.apache.org/schema/spring":dataFormats,
> "http://camel.apache.org/schema/spring":onException,
> "http://camel.apache.org/schema/spring":onCompletion,
> "http://camel.apache.org/schema/spring":intercept,
> "http://camel.apache.org/schema/spring":interceptFrom,
> "http://camel.apache.org/schema/spring":interceptSendToEndpoint,
> "http://camel.apache.org/schema/spring":route}' is expected.
> 
> 
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
> 
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> 


Mime
View raw message