Open molk opened 10 years ago
Hi Marcus!
Have you add the @Component tag, to the RespondAck bean?
Or have you added the
I hope it helps!
Ignacio
Hi Ignacio,
thanks for the immediate reply!
I did not change the code I pulled from GitHub at all, that's why I am surprised why it is not running. I cloned the git URL and ran the suggested maven commands. The listener starts up and the client sends the message that results in the described error.
Marcus
Hi Mark!
You are right, I need time to figure out why is not working properly. In the meanwhile, I have created a new branch called "dev/main" that uses a configuration file to declare the beans. Please have a look, and let me know if that works fine.
thanks for the feedback!
Works like a charm. Thanks!
Hi,
I have fixed the master branch. The thing is that when we use the "@Component" annotation by default the bean is registered with the same name as the class but with the first letter in lower case. So I have changed the name in the InboundRouteBuilder to respondACK.
Now, it's up to you which way do you prefer to run it, with the configuration file or with the component-scan.
Ingnacio, thanks for clarifying this. Sure, that's the way Spring works. We once wrote a wrapper that allows both cases.
Cheers, Marcus
Hi.
When running the suggested example (mvn camel:run and mvn -Dtest=TestListener test) I receive the following error:
org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK
Debugging shows that the bean gets instantiated (component scan seems to work) and registry.lookupByType(RespondACK.class) finds the bean, but registry.lookup("RespondACK") does not, resulting to this error.
Any idea what's wrong here?
Marcus
Detailed log: [INFO] Scanning for projects... [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building Camel-Hl7-listener 1.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> camel-maven-plugin:2.10.6:run (default-cli) @ Camel-Hl7-listener >>> [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ Camel-Hl7-listener --- [debug] execute contextualize [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 3 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Camel-Hl7-listener --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ Camel-Hl7-listener --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /Users/molk/marcus/projects/Camel-HL7-Listener/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Camel-Hl7-listener --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< camel-maven-plugin:2.10.6:run (default-cli) @ Camel-Hl7-listener <<< [INFO] [INFO] --- camel-maven-plugin:2.10.6:run (default-cli) @ Camel-Hl7-listener --- [INFO] Using org.apache.camel.spring.Main to initiate a CamelContext 2013-11-25 10:08:40,708 [ing.Main.main()] INFO MainSupport - Apache Camel 2.10.6 starting hl7Integration.camel.RespondACK 2013-11-25 10:08:42,155 [ing.Main.main()] INFO SpringCamelContext - Apache Camel 2.10.6 (CamelContext: camelContext) is starting 2013-11-25 10:08:42,303 [ing.Main.main()] INFO ManagementStrategyFactory - JMX enabled. 2013-11-25 10:08:42,411 [ing.Main.main()] INFO DefaultTypeConverter - Loaded 179 type converters 2013-11-25 10:08:42,622 [ing.Main.main()] INFO MinaConsumer - Binding to server address: localhost/127.0.0.1:4444 using acceptor: org.apache.mina.transport.socket.nio.SocketAcceptor@5b9f1bac 2013-11-25 10:08:42,640 [ing.Main.main()] INFO SpringCamelContext - Route: route_hl7listener started and consuming from: Endpoint[mina://tcp://localhost:4444?codec=%23hl7codec&sync=true] 2013-11-25 10:08:42,640 [ing.Main.main()] INFO ultManagementLifecycleStrategy - StatisticsLevel at All so enabling load performance statistics 2013-11-25 10:08:42,649 [ing.Main.main()] INFO SpringCamelContext - Total 1 routes, of which 1 is started. 2013-11-25 10:08:42,650 [ing.Main.main()] INFO SpringCamelContext - Apache Camel 2.10.6 (CamelContext: camelContext) started in 0.495 seconds 2013-11-25 10:08:49,880 [ MinaThreadPool] INFO VersionLogger - HAPI version is: 1.2 2013-11-25 10:08:49,895 [ MinaThreadPool] INFO Parser - Instantiating msg of class ca.uhn.hl7v2.model.v25.message.ADT_A01 2013-11-25 10:08:50,004 [ MinaThreadPool] WARN ObjectHelper - Cannot find class: RespondACK 2013-11-25 10:08:50,005 [ MinaThreadPool] ERROR DefaultErrorHandler - Failed delivery for (MessageId: ID-marcuso-nb-mgm-edv-de-55901-1385370522015-0-1 on ExchangeId: ID-marcuso-nb-mgm-edv-de-55901-1385370522015-0-2). Exhausted after delivery attempt: 1 caught: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK at org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:68) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:77) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67) at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101) at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:335) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:308) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.messageReceived(MinaConsumer.java:113) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) 2013-11-25 10:08:50,010 [ MinaThreadPool] WARN MinaHelper - Cannot write body: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK using session: (SOCKET, R: /127.0.0.1:55909, L: /127.0.0.1:4444, S: localhost/127.0.0.1:4444) 2013-11-25 10:08:50,012 [ MinaThreadPool] WARN MinaConsumer$ReceiveHandler - [/127.0.0.1:55909] Unexpected exception from exceptionCaught handler. org.apache.camel.CamelException: org.apache.mina.filter.codec.ProtocolEncoderException: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:91) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564) at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345) at org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) Caused by: org.apache.mina.filter.codec.ProtocolEncoderException: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:224) at org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite(AbstractIoFilterChain.java:361) at org.apache.mina.common.support.AbstractIoFilterChain.access$1300(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterWrite(AbstractIoFilterChain.java:659) at org.apache.mina.filter.executor.ExecutorFilter.filterWrite(ExecutorFilter.java:236) at org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite(AbstractIoFilterChain.java:361) at org.apache.mina.common.support.AbstractIoFilterChain.access$1300(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterWrite(AbstractIoFilterChain.java:659) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.filterWrite(AbstractIoFilterChain.java:587) at org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite(AbstractIoFilterChain.java:361) at org.apache.mina.common.support.AbstractIoFilterChain.fireFilterWrite(AbstractIoFilterChain.java:355) at org.apache.mina.transport.socket.nio.SocketSessionImpl.write0(SocketSessionImpl.java:166) at org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:177) at org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:168) at org.apache.camel.component.mina.MinaHelper.writeBody(MinaHelper.java:48) at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.messageReceived(MinaConsumer.java:148) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) ... 4 more Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: RespondACK at org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:68) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:77) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67) at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101) at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:335) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:308) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.Pipeline.process(Pipeline.java:117) at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.messageReceived(MinaConsumer.java:113) ... 9 more 2013-11-25 10:08:50,013 [ MinaThreadPool] WARN MinaConsumer$ReceiveHandler - [/127.0.0.1:55909] Unexpected exception from exceptionCaught handler. org.apache.camel.CamelException: org.apache.camel.CamelExchangeException: Cannot write body. Exchange[Message: [Body is null]] at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:91) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564) at org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345) at org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) Caused by: org.apache.camel.CamelExchangeException: Cannot write body. Exchange[Message: [Body is null]] at org.apache.camel.component.mina.MinaHelper.writeBody(MinaHelper.java:55) at org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.messageReceived(MinaConsumer.java:148) at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) ... 4 more