You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dsach1w <da...@gmail.com> on 2008/02/15 22:38:55 UTC

Having trouble getting EndpointInjection working

All,

Perhaps I'm doing something wrong, but I can't seem to get endpoint
injection working.  When I try to run the attached code, I get the null
pointer exception below:


0 [xyz.dropkick.Main.main()] INFO xyz.dropkick.Main  - Entering application.
Refreshing All Companies
297 [foo] ERROR org.apache.camel.processor.DeadLetterChannel  - On delivery
attempt: 0 caught: java.lang.NullPointerException
java.lang.NullPointerException
	at xyz.dropkick.RefreshCompanies.refresh(RefreshCompanies.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:119)
	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:66)
	at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:113)
	at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:74)
	at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:52)
	at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:136)
	at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:86)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
	at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:100)
	at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:52)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)

It appears that the ProducerTemplate is not getting injected for some
reason.

Forgive me for the basic question, but I've struggled to get this working. 
I've looked at the EndpointInjection test cases, but those don't seem to be
doing the same thing.  I am looking at using a Spring version as an
alternative, but I'd like to try to make it work this way.

http://www.nabble.com/file/p15510575/Main.java Main.java 

http://www.nabble.com/file/p15510575/RefreshCompanies.java
RefreshCompanies.java 

http://www.nabble.com/file/p15510575/RefreshCompany.java RefreshCompany.java 

Thanks for your help,

David
-- 
View this message in context: http://www.nabble.com/Having-trouble-getting-EndpointInjection-working-tp15510575s22882p15510575.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Having trouble getting EndpointInjection working

Posted by James Strachan <ja...@gmail.com>.
On 16/02/2008, dsach1w <da...@gmail.com> wrote:
>
>  FYI, I got this working using Spring, so the message below is no longer an
>  issue.

Endpoint injection only works with Spring :) I guess we should make
that more obvious in the documentation.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Having trouble getting EndpointInjection working

Posted by dsach1w <da...@gmail.com>.
FYI, I got this working using Spring, so the message below is no longer an
issue.

Thanks,

David


dsach1w wrote:
> 
> All,
> 
> Perhaps I'm doing something wrong, but I can't seem to get endpoint
> injection working.  When I try to run the attached code, I get the null
> pointer exception below:
> 
> <pre>
> 0 [xyz.dropkick.Main.main()] INFO xyz.dropkick.Main  - Entering
> application.
> Refreshing All Companies
> 297 [foo] ERROR org.apache.camel.processor.DeadLetterChannel  - On
> delivery attempt: 0 caught: java.lang.NullPointerException
> java.lang.NullPointerException
> 	at xyz.dropkick.RefreshCompanies.refresh(RefreshCompanies.java:22)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:119)
> 	at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:66)
> 	at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:113)
> 	at
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:74)
> 	at
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:52)
> 	at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
> 	at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:136)
> 	at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:86)
> 	at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
> 	at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
> 	at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
> 	at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:100)
> 	at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:52)
> 	at java.util.TimerThread.mainLoop(Timer.java:512)
> 	at java.util.TimerThread.run(Timer.java:462)
> </pre>
> It appears that the ProducerTemplate is not getting injected for some
> reason.
> <p>
> Forgive me for the basic question, but I've struggled to get this working. 
> I've looked at the EndpointInjection test cases, but those don't seem to
> be doing the same thing.  I am looking at using a Spring version as an
> alternative, but I'd like to try to make it work this way.
> <br>
>  http://www.nabble.com/file/p15510575/Main.java Main.java <br>
>  http://www.nabble.com/file/p15510575/RefreshCompanies.java
> RefreshCompanies.java <br>
>  http://www.nabble.com/file/p15510575/RefreshCompany.java
> RefreshCompany.java 
> <p>
> Thanks for your help,
> <p>
> David
> 

-- 
View this message in context: http://www.nabble.com/Having-trouble-getting-EndpointInjection-working-tp15510575s22882p15514573.html
Sent from the Camel - Users mailing list archive at Nabble.com.