当前位置: 首页 > 知识库问答 >
问题:

Tomcat:从元素“包扫描”开始发现无效内容

郤浩慨
2023-03-14

我正在创建以下Camelhtml" target="_blank">配置:

<?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"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       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
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/spring">

      <routeContextRef ref="DoItRoute"/>

      <onException id="OnException">
         <exception>java.sql.SQLException</exception>
         <exception>java.lang.Exception</exception>
         <redeliveryPolicy maximumRedeliveries="0" />
         <to id="ErrorProcessor"                                  uri="bean:errorProcessor"/>
      </onException>

      <packageScan>
         <package>com.myself.route.doit</package>
         <excludes>*ExcludeMe*</excludes>
      </packageScan>

    </camelContext>

</beans>
Element : camelContext
Content Model : (routeContextRef? | onException? | packageScan?)*

org.springframework.beans.factory.XML.xmlBeanDefinitionStoreException:来自类路径资源[META-INF/spring/my-route.XML]的XML文档中的第23行无效;嵌套异常是org.xml.sax.SaxParseException;亚麻编号:23;专栏编号:20;cvc-complex-type.2.4.a:从元素“package scan”开始发现无效内容。“{”http://camel.apache.org/schema/spring“:onexception,”http://camel.apache.org/schema/spring“:oncompletity,”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“:restconfiguration,”‘是预期的。

这是怎么回事?Eclipse和Tomcat使用不同的XSD?我怎么解决这个?

共有1个答案

孙佐
2023-03-14

命令很重要!!..尝试重新排列标签如下,它将工作。

 <camelContext xmlns="http://camel.apache.org/schema/spring">              

     <packageScan>
         <package>com.myself.route.doit</package>
         <excludes>*ExcludeMe*</excludes>
      </packageScan>

      <routeContextRef ref="DoItRoute"/>

      <onException id="OnException">
         <exception>java.sql.SQLException</exception>
         <exception>java.lang.Exception</exception>
         <redeliveryPolicy maximumRedeliveries="0" />
         <to id="ErrorProcessor"                                  uri="bean:errorProcessor"/>
      </onException>      

    </camelContext>

@参考http://camel.apache.org/schema/spring/camel-spring-2.15.0.xsd。(标签序列可以在这里识别)

 类似资料: