问题
I am trying to configure the spring transaction policy
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
</bean>
<bean id="PROPAGATION_REQUIRED" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="transactionManager" />
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
</bean>
this is my exception
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry of type: PlatformTransactionManager
I don't know why i am getting that exception. Can anyone help?
This is my Stack Trace.Hope this helps
org.apache.camel.FailedToCreateRouteException: Failed to create route RetryableRoute at: >>> Transacted[] <<< in route: Route(RetryableRoute)[[From[direct:start]] -> [Transacted[]]... because of No bean could be found in the registry of type: PlatformTransactionManager
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:910) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:175) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:780) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2068) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1816) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1683) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1651) ~[camel-core-2.13.2.jar:2.13.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[na:1.6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[na:1.6.0]
at java.lang.reflect.Method.invoke(Method.java:611) ~[na:1.6.0]
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:407) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) [camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) [camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:157) [camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:68) [camel-core-2.13.2.jar:2.13.2]
at java.util.Timer$TimerImpl.run(Timer.java:296) [na:na]
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry of type: PlatformTransactionManager
at org.apache.camel.model.TransactedDefinition.doResolvePolicy(TransactedDefinition.java:234) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.TransactedDefinition.resolvePolicy(TransactedDefinition.java:168) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.TransactedDefinition.createProcessor(TransactedDefinition.java:145) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:499) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:212) ~[camel-core-2.13.2.jar:2.13.2]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:907) ~[camel-core-2.13.2.jar:2.13.2]
... 23 common frames omitted
回答1:
I know this may not help with the original question, but I came here looking for a solution to:
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry of type: PlatformTransactionManage
while trying to setup transactions for a SQL data-source for an apache camel route and found that specifying it like, in camel-context.xml:
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mydatasource"/>
</bean>
Solves my issue.
来源:https://stackoverflow.com/questions/32250948/because-of-no-bean-could-be-found-in-the-registry-of-type-platformtransactionma