The NPE is caused by we can't set the soTimeout before the FtpClient
connecting the server.
How about set the option of defaultTimeout ?
Here is great blog[1] which discuss about it.
[1]http://sudhirvn.blogspot.com/2007/05/ftpclient-timeout-values.html
Willem
Srini97 wrote:
The following is the entire stack trace of the NPE wheI tried to soTimeout
option
[2010-05-28
16:25:37,554][DefaultMessageListenerContainer-1][ERROR][org.apache.camel.component.jms.EndpointMessageLis
tener][] Caused by: [org.apache.camel.FailedToCreateProducerException -
Failed to create Producer for endpoint: Endpo
int[ftp://[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connect
Timeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aV
NY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp]. Reason:
org.apache.camel.FailedToCreateProducerException: Fai
led to create Producer for endpoint:
Endpoint[ftp://[email protected]/?eagerDeleteTargetFile=false&fileNam
e=srml-4-2009-squads.xml&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&f
tpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Reason: java.lang.N ullPointerException]
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint: Endpoint[ftp://castrolfootb
[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120000&ftpClie
nt.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&tempFileName
=%24%7Bfile%3Aname.noext%7D.tmp]. Reason:
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint:
Endpoint[ftp://[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.x
ml&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150
000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Reason: java.lang.NullPointerException
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:256)
at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:90)
at
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:115)
at
org.apache.camel.processor.RecipientList.process(RecipientList.java:97)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:97)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:75)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:84)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListener
Container.java:543)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerCo
ntainer.java:482)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListene
rContainer.java:451)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPolli
ngMessageListenerContainer.java:323)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPolling
MessageListenerContainer.java:261)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListene
r(DefaultMessageListenerContainer.java:982)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoin
gLoop(DefaultMessageListenerContainer.java:974)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMe
ssageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.camel.FailedToCreateProducerException: Failed to
create Producer for endpoint: Endpoint[ftp://c
[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120
000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&t
empFileName=%24%7Bfile%3Aname.noext%7D.tmp]. Reason:
java.lang.NullPointerException
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:65)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:58)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:31)
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:252)
... 23 more
Caused by: java.lang.NullPointerException
at
org.apache.commons.net.SocketClient.setSoTimeout(SocketClient.java:374)
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.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:264)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:230)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:240)
at
org.apache.camel.component.file.remote.FtpEndpoint.createRemoteFileOperations(FtpEndpoint.java:79)
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:63)
... 26 more
[2010-05-28 16:25:37,556][DefaultMessageListenerContainer-1][WARN
][org.springframework.jms.listener.DefaultMessageLi
stenerContainer][] Execution of JMS message listener failed
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint: Endpoint[ftp://castrolfootb
[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120000&ftpClie
nt.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&tempFileName
=%24%7Bfile%3Aname.noext%7D.tmp]. Reason:
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint:
Endpoint[ftp://[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.x
ml&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150
000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Reason: java.lang.NullPointerException
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:256)
at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:90)
at
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:115)
at
org.apache.camel.processor.RecipientList.process(RecipientList.java:97)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:97)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:75)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:84)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListener
Container.java:543)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerCo
ntainer.java:482)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListene
rContainer.java:451)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPolli
ngMessageListenerContainer.java:323)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPolling
MessageListenerContainer.java:261)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListene
r(DefaultMessageListenerContainer.java:982)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoin
gLoop(DefaultMessageListenerContainer.java:974)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMe
ssageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.camel.FailedToCreateProducerException: Failed to
create Producer for endpoint: Endpoint[ftp://c
[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120
000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&t
empFileName=%24%7Bfile%3Aname.noext%7D.tmp]. Reason:
java.lang.NullPointerException
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:65)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:58)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:31)
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:252)
... 23 more
Caused by: java.lang.NullPointerException
at
org.apache.commons.net.SocketClient.setSoTimeout(SocketClient.java:374)
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.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:264)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:230)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:240)
at
org.apache.camel.component.file.remote.FtpEndpoint.createRemoteFileOperations(FtpEndpoint.java:79)
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:63)
... 26 more
==> cif_02.log <==
[2010-05-28
16:25:40,452][DefaultMessageListenerContainer-1][DEBUG][com.opta.delivery.RecipientAggregationStrategy][]
target:
ftp://[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeo
ut=180000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&password=b3A5f83p&tempFileName=%24%7Bfile%3Aname
.noext%7D.tmp
[2010-05-28
16:25:40,453][DefaultMessageListenerContainer-1][DEBUG][com.opta.delivery.RecipientAggregationStrategy][]
transfer-time: 5873 msec
[2010-05-28 16:25:40,453][DefaultMessageListenerContainer-1][INFO
][com.opta.delivery.RecipientAggregationStrategy][]
route end for endpoint on trail=58875, delivered=true
[2010-05-28
16:25:40,484][DefaultMessageListenerContainer-1][DEBUG][com.opta.delivery.RecipientAggregationStrategy][]
target:
sftp://[email protected]/?disconnect=true&fileName=srml-4-2009-squads.xml&knownHostsFile=%2Froot%2F.ssh%2F
known_hosts&privateKeyFile=%2Froot%2F.ssh%2Fid_rsa
[2010-05-28
16:25:40,484][DefaultMessageListenerContainer-1][DEBUG][com.opta.delivery.RecipientAggregationStrategy][]
transfer-time: 2850 msec
[2010-05-28 16:25:40,484][DefaultMessageListenerContainer-1][INFO
][com.opta.delivery.RecipientAggregationStrategy][]
route end for endpoint on trail=58876, delivered=true
[2010-05-28 16:25:40,502][DefaultMessageListenerContainer-1][INFO
][EndProcessor][] delivery chunk completed
[r...@valdedist01 opta]#
[r...@valdedist01 opta]# less cif.log
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:75)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:84)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.ja
a:982)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContaine
.java:974)
at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.camel.FailedToCreateProducerException: Failed to
create Producer for endpoint:
Endpoint[ftp://[email protected]/?eagerDe
eteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.
oTimeout=150000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Reason: java.lang.NullPointerException
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:65)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:58)
at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createProducer(RemoteFileEndpoint.java:31)
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:252)
... 23 more
Caused by: java.lang.NullPointerException
at
org.apache.commons.net.SocketClient.setSoTimeout(SocketClient.java:374)
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.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:264)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:230)
at
org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:240)
at
org.apache.camel.component.file.remote.FtpEndpoint.createRemoteFileOperations(FtpEndpoint.java:79)
at
org.apache.camel.component.file.remote.FtpEndpoint.buildProducer(FtpEndpoint.java:63)
... 26 more
[2010-05-28 16:25:37,556][DefaultMessageListenerContainer-1][WARN
][org.springframework.jms.listener.DefaultMessageListenerContainer][]
Execution of JMS essage listener failed
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint:
Endpoint[ftp://[email protected]/?eagerDeleteTargetF
le=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=120000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=1
0000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp].
Reason: org.apache.camel.FailedToCreateProducerException: Failed to create P
oducer for endpoint:
Endpoint[ftp://[email protected]/?eagerDeleteTargetFile=false&fileName=srml-4-2009-squads.xml&ftpClient.connectTimeout=12
000&ftpClient.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.soTimeout=150000&password=C3te4aVNY8fWNnGr&tempFileName=%24%7Bfile%3Aname.noext%
D.tmp]. Reason: java.lang.NullPointerException
at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:256)
at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:90)
at
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:115)
at
org.apache.camel.processor.RecipientList.process(RecipientList.java:97)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
I run the component which uses camel as standalone process., I mean from
main method
Claus Ibsen-2 wrote:
On Fri, May 28, 2010 at 4:33 PM, Srini97 <[email protected]>
wrote:
I am using Camel2.3 and I tried to use soTimeout as well. But it throuing
Null pointer exception saying it is unable create producer.
Can you post the endpoint configuration and the stacktrace which
causes this NPE.
And how do you run Camel?
Claus Ibsen-2 wrote:
Hi
Have you tried with ftpClient.soTimeout also?
And what version of Camel are you using?
On Thu, May 27, 2010 at 2:06 PM, Srini97 <[email protected]>
wrote:
Hello,
I am using the following URI for the delivery to FTp end point.
ftp://[email protected]/?fileName=srml-4-2009-squads.xml&password=C3te4aVNY8fWNnGr&ftpClie
t.dataTimeout=15000&ftpClient.defaultTimeout=15000&ftpClient.connectTimeout=120000&tempFileName=%24%7Bfile%3Aname.noext%7D.tmp&eagerDelet
TargetFile=false
first thing is It is not dleivering it to the endpoint.
even though I used ftpClient.connectTimeout=120000 it is not
disconnecting,
more over it is waiting the for almost 20 min which is very costly for
me.
Any idea why this is happening. Thanks for the hep.
Regards
Sri
--
View this message in context:
http://old.nabble.com/Camel-FTP-is-not-responding-and-returning-code-0-as-connectiontime-out-tp28693025p28693025.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
--
View this message in context:
http://old.nabble.com/Camel-FTP-is-not-responding-and-returning-code-0-as-connectiontime-out-tp28693025p28707675.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus