我正在尝试在骆驼中创建一个简单的路由,从 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:run 在骆驼上运行它时,我收到以下错误
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..我对这个错误感到不知所措。提前致谢。