同事们,我有骆驼上下文文件:
<?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"
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-2.0.0.xsd">
<bean id="myFilter" class="com.ac.am.CamelComp.CurrentDateFileFilter"/>
<bean id="xsdProcessor" class="com.ac.am.CamelComp.MessProcessor"/>
<bean id="startPolicy" class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy">
<property name="routeStartTime" value="0 0/5 * ? * 1-6 *" />
</bean>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="uploadFromFtp" routePolicyRef="startPolicy">
<camel:from uri="sftp://
&throwExceptionOnConnectFailed=true
&consumer.delay=10000
&recursive=true"/>
<camel:to uri="bean:xsdProcessor"/>
<camel:to uri="file:sftp-inbound"/>
</route>
</camel:camelContext>
</beans>
我使用mvn clean compile assembly:single
. 当我运行 jar 时,我收到下一个堆栈跟踪:
[32m13:37:27.923[0;39m [34mINFO [0;39m [32m[main][0;39m [36mo.sbfxml.XmlBeanDefinitionReader[0;39m:从类路径资源加载 XML bean 定义 [camel-context.xml ] [32m13:37:28.331[0;39m [31mWARN [0;39m [32m[main][0;39m [36mo.scaAnnotationConfigApplicationContext[0;39m:上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans .factory.xml.XmlBeanDefinitionStoreException:来自类路径资源 [camel-context.xml] 的 XML 文档中的第 24 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:24;列号:66;cvc-complex-type.3.2.2:属性“routePolicyRef”不允许出现在元素“路由”中。线程“主”org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 中的异常:来自类路径资源 [camel-context.xml] 的 XML 文档中的第 24 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:24;列号:66;cvc-complex-type.3.2.2:属性“routePolicyRef”不允许出现在元素“路由”中。在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) 在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) 在 org.springframework.beans.factory .xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) .... 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java: 93) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) 在 org.springframework.context.annotation.AnnotationConfigApplicationContext 的 org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) .(AnnotationConfigApplicationContext.java:84) at com.ac.am.AmeFtp.main(AmeFtp.java:32) 由:org.xml.sax.SAXParseException; 行号:24;列号:66;cvc-complex-type.3.2.2:属性“routePolicyRef”不允许出现在元素“路由”中。在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper 的 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(未知来源)。
第 23 行是:
<route id="uploadFromFtp" routePolicyRef="startPolicy">
你能帮忙修一下吗?谢谢你。
更新
camel
已添加route
,但没有任何内容
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route id="uploadFromFtp" routePolicyRef="startPolicy">
<camel:from uri="sftp:......
&throwExceptionOnConnectFailed=true
&consumer.delay=10000
&recursive=true"/>
<camel:to uri="bean:xsdProcessor"/>
<camel:to uri="file:sftp-inbound"/>
</camel:route>
</camel:camelContext>
堆:
Caused by: org.xml.sax.SAXParseException; lineNumber: 24; columnNumber: 72; cvc-complex-type.3.2.2: Attribute 'routePolicyRef' is not allowed to appear in element 'camel:route'.
lineNumber: 24;
是<camel:camelContext xmlns="http://camel.apache.org/schema/spring">