微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

XML没有拿起标签

这可能是一个简单的错误配置问题,但我的xml文档拿起我的标签时遇到问题.我收到了错误

在这一行找到了多个注释:
     – cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素’camelContext’找到声明.
     – 无法找到模式名称空间“http://activemq.apache.org/camel/”的元素“camelContext”的Spring NamespaceHandler

但是当我添加命名空间时,我收到以下错误

在此行找到多个注释:
     – cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素’camelContext’找到声明.
     – schema_reference.4:无法读取架构文档“http://activemq.apache.org/camel/schema/spring/camel-spring.xsd”,因为1)无法读取
     找到文件; 2)文件无法阅读; 3)文档的根元素不是.
     – 无法找到模式名称空间“http://activemq.apache.org/camel/schema/spring”的元素“camelContext”的Spring NamespaceHandler

任何人都可以帮我弄清楚为什么我会遇到这两个问题?我不是xml或骆驼的专家,所以任何帮助将不胜感激.
下面是我的简单xml文档:

<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>

解决方法:

在Camel 1.x中,XML的名称空间是以activemq开头的名称空间,例如

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

在Camel 2.x中,XML的名称空间是纯粹的Camel,例如

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

由于Camel 1.x是EOL,我假设你使用的是Camel 2.x.如果是这样,你需要改变<中的名称空间. camelContext>标记为2.x样式.并删除XML文件顶部的旧引用.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。