在camel路由中验证出错

时间:2012-06-18 08:53:29

标签: apache-camel

我正在使用camel来验证xml,并且在路由中我正在执行以下操作:

<route>
    <from uri="file:{{file.inbox}}?preMove=inprogress&amp;move=../.done"/>
    <doTry>
        <to uri="validator:classpath:idocOrderStatus.xsd"/>
        <to uri="file:{{file.outbox.valid}}"/>
        <doCatch>
            <exception>org.apache.camel.ValidationException</exception>
            <to uri="file:{{file.outbox.invalid}}"/>
        </doCatch>
    </doTry>
</route>

我收到以下错误:

    Exception in thread "SpringOsgiExtenderThread-10" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route7 at: >>> DoT
ry[[To[validator:classpath:idocOrderStatus.xsd], To[file:outbox/valid], DoCatch[ null -> [To[file:{{file.outbox.invalid}}]]]]] <<< in route: Route[[From[file:{{file.inbox}}?preMove=inprogres
s&move=../.... because of org.apache.camel.ValidationException
        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1157)
        at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:110)
        at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
        at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:
132)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route7 at: >>> DoTry[[To[validator:classpath:idocOrderStatus.xsd], To[file:outbox/valid], DoCatch[ null -> [T
o[file:{{file.outbox.invalid}}]]]]] <<< in route: Route[[From[file:{{file.inbox}}?preMove=inprogress&move=../.... because of org.apache.camel.ValidationException
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:820)
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
        at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:685)
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1683)
        at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1468)
        at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1360)
        at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:169)
        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1328)
        at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:213)
        at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:108)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.camel.ValidationException
        at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52)
        at org.apache.camel.model.CatchDefinition.createExceptionClasses(CatchDefinition.java:254)
        at org.apache.camel.model.CatchDefinition.createProcessor(CatchDefinition.java:91)
        at org.apache.camel.model.TryDefinition.createProcessor(TryDefinition.java:90)
        at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:444)
        at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:183)
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:817)
        ... 21 more

我不知道为什么我会收到这个错误?无论如何都要在驼峰上下文中导入这个类?我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以在论坛fuse forum

找到解决方案