骆驼路线出错

时间:2013-10-18 14:36:43

标签: maven apache-camel fuseesb jbossfuse

我正在尝试在camel中创建一个简单的路由,从rest uri接收消息并将消息存储在缓存中,我已经完成了以下操作

我的路线如下

<camel:endpoint id="fooCache1" uri="cache:TestCache1"/>  <camel:from uri="cxfrs://bean://rsServer" />
        <camel:to uri="log:output?showAll=true" />
        <camel:to uri="bean:payProcessor" />
        <camel:to uri="direct:start" />
        </camel:route>
               <camel:route>
    <camel:from uri="direct:start" />   
    <camel:setHeader headerName="CamelCacheOperation">
            <camel:constant>CamelCacheAdd</camel:constant>
        </camel:setHeader>
        <camel:setHeader headerName="CamelCacheKey">
            <camel:constant>myCache</camel:constant>
        </camel:setHeader>
     <camel:to  ref="fooCache1"/>
<camel:to uri="log:output?showAll=true" />
     </camel:route>

当试图通过mvn camel在驼峰上运行它时:运行我得到以下错误

   Error occurred while running main from: org.apache.camel.spring.Main
    java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:440)
            at java.lang.Thread.run(Thread.java:724)
    Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCrea
    teRouteException: Failed to create route route2 at: >>> To[ref:fooCache1] <<< in
     route: Route[[From[direct:start]] -> [SetHeader[CamelCacheOperation... because
    of org.springframework.beans.factory.BeanCreationException: Error creating bean
    with name 'fooCache1': FactoryBean threw exception on object creation; nested ex
    ception is java.lang.NoSuchMethodError: org.apache.camel.util.ObjectHelper.notNu
    ll(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
            at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHe
    lper.java:1271)
            at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringC
    amelContext.java:120)
            at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(Ca
    melContextFactoryBean.java:280)
            at org.springframework.context.event.SimpleApplicationEventMulticaster.m
    ulticastEvent(SimpleApplicationEventMulticaster.java:97)
            at org.springframework.context.support.AbstractApplicationContext.publis
    hEvent(AbstractApplicationContext.java:303).....

有人可以让我知道我错在哪里以及为什么没有创建缓存bean。我对这个错误感到茫然。 提前谢谢。

2 个答案:

答案 0 :(得分:0)

检查camel-spring和camel-core组件的版本,在您的情况下似乎存在兼容性问题。使用两个库的相同版本。

答案 1 :(得分:0)

将骆驼版改为2.12.1后,它现在正常工作..