Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML not picking up <camelContext> tag

this is probably a simple mis configuration problem but I am having an issue with my xml document picking up my tag. I am getting the error

"Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'. - Unable to locate Spring NamespaceHandler for element 'camelContext' of schema namespace 'http://activemq.apache.org/camel/"

But when I add in the namespace I get the following error:

Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'camelContext'. - schema_reference.4: Failed to read schema document 'http://activemq.apache.org/camel/schema/spring/camel-spring.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . - Unable to locate Spring NamespaceHandler for element 'camelContext' of schema namespace 'http://activemq.apache.org/camel/schema/spring'

Can anyone help me figure out why I am getting both of these issues? I am not expert in xml or camel so any help would be greatly appreciated. Below is my simple xml document:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://activemq.apache.org/camel/schema/spring     http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
      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="myrouter"      class="org.apache.camel.example.reportincident.ReportIncidentRoutes"/>



<!-- Camel Configuration -->

 <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <routeBuilderRef ref="myrouter"/>


 </camelContext>

</beans>
like image 650
parchambeau Avatar asked Feb 17 '23 20:02

parchambeau


1 Answers

In Camel 1.x the namespace for the XML is the one that start with activemq, eg

xmlns="http://activemq.apache.org/camel/schema/spring"

In Camel 2.x the namespace for the XML is pure Camel, eg

http://camel.apache.org/schema/spring

As Camel 1.x is EOL I assume you are using Camel 2.x. And if so you need to change t he namespace in the < camelContext > tag to the 2.x style. And remove the old reference as well in the top of your XML file.

like image 180
Claus Ibsen Avatar answered Feb 27 '23 13:02

Claus Ibsen