You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/11/10 12:31:15 UTC
Camel-OSGI and namespaces
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
Re: Camel-OSGI and namespaces
Posted by Charles Moulliard <cm...@gmail.com>.
Thx.
It should be interesting to mention it in the wiki page :
http://camel.apache.org/spring.html
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
On Tue, Nov 10, 2009 at 12:57 PM, Willem Jiang <wi...@gmail.com> wrote:
> 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
>>
>
>
Re: Camel-OSGI and namespaces
Posted by Willem Jiang <wi...@gmail.com>.
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
>