You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alberto Brosich <ab...@ogs.trieste.it> on 2014/05/20 10:38:01 UTC

FTP consumer sometimes throws NullPointerException

Hi,
I have an exception from a ftp consumer only for few files. Camel
version is 2.13.1.

- It happens on few files (2 or 3). Remote directory contains many files
(many thousand)

- These few files have the same ownership and permissions of the others
and are not empty

- I stopped the application that create the files, to avoid any possible
lock (anyway, I can modify them without problems)

- I tried to copy and rename the files, removing the old one, (to create
a completely new one) without success

- Looking at the source code in
FtpChangedExclusiveReadLockStrategy.java, the error happens getting the
timestamp of the file:
for (FTPFile f : files) {
    if (f.getName().equals(file.getFileNameOnly())) {
        newLastModified = f.getTimestamp().getTimeInMillis();
        newLength = f.getSize();
    }
}

- Remote ftp server is IIS on windows 2000 server :o

- Nothing useful in the logs of the ftp server

Follow a trace log and the exception regarding one of those files:

2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
Waiting for exclusive read lock to file:
RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
Waiting for exclusive read lock to file:
RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
Waiting for exclusive read lock to file:
RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
Using fast exists to update file information for
RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
Using fast exists to update file information for
RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
2014-05-19 16:21:32,650 WARN  FtpConsumer -
Endpoint[ftp://xxxx@yy.yy.yy.yy//dwrg1/moved?delay=60000&disconnect=true&fastExistsCheck=true&idempotent=true&idempotentKey=%24%7Bfile%3Aname%7D-%24%7Bfile%3Amodified%7D-%24%7Bfile%3Asize%7D&idempotentRepository=%23fileStore&include=DWRG1.*%5C.xml&maxMessagesPerPoll=10&noop=true&password=xxxxxx&readLock=changed&sortBy=file%3Amodified] cannot begin processing file: RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml] due to: null. Caused by: [java.lang.NullPointerException - null]
java.lang.NullPointerException
	at
org.apache.camel.component.file.remote.strategy.FtpChangedExclusiveReadLockStrategy.acquireExclusiveReadLock(FtpChangedExclusiveReadLockStrategy.java:83)
	at
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:49)
	at
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:35)
	at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:326)
	at
org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
	at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
	at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
	at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
	at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
	at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)


Someone can explain what happens?

Regards

Alberto


Re: FTP consumer sometimes throws NullPointerException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Not sure what happens. But we could try get that NPE fixed in Camel,
as that is a bug in Camel.

Fell free to log a JIRA.
And the stacktrace is handy so you are welcome to put that in the jira too.



On Tue, May 20, 2014 at 10:38 AM, Alberto Brosich
<ab...@ogs.trieste.it> wrote:
>
> Hi,
> I have an exception from a ftp consumer only for few files. Camel
> version is 2.13.1.
>
> - It happens on few files (2 or 3). Remote directory contains many files
> (many thousand)
>
> - These few files have the same ownership and permissions of the others
> and are not empty
>
> - I stopped the application that create the files, to avoid any possible
> lock (anyway, I can modify them without problems)
>
> - I tried to copy and rename the files, removing the old one, (to create
> a completely new one) without success
>
> - Looking at the source code in
> FtpChangedExclusiveReadLockStrategy.java, the error happens getting the
> timestamp of the file:
> for (FTPFile f : files) {
>     if (f.getName().equals(file.getFileNameOnly())) {
>         newLastModified = f.getTimestamp().getTimeInMillis();
>         newLength = f.getSize();
>     }
> }
>
> - Remote ftp server is IIS on windows 2000 server :o
>
> - Nothing useful in the logs of the ftp server
>
> Follow a trace log and the exception regarding one of those files:
>
> 2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
> Waiting for exclusive read lock to file:
> RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
> 2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
> Waiting for exclusive read lock to file:
> RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
> 2014-05-19 16:21:32,298 TRACE FtpChangedExclusiveReadLockStrategy -
> Waiting for exclusive read lock to file:
> RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
> 2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
> Using fast exists to update file information for
> RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
> 2014-05-19 16:21:32,299 TRACE FtpChangedExclusiveReadLockStrategy -
> Using fast exists to update file information for
> RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml]
> 2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
> files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
> 2014-05-19 16:21:32,640 TRACE FtpChangedExclusiveReadLockStrategy - List
> files /dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml found 1 files
> 2014-05-19 16:21:32,650 WARN  FtpConsumer -
> Endpoint[ftp://xxxx@yy.yy.yy.yy//dwrg1/moved?delay=60000&disconnect=true&fastExistsCheck=true&idempotent=true&idempotentKey=%24%7Bfile%3Aname%7D-%24%7Bfile%3Amodified%7D-%24%7Bfile%3Asize%7D&idempotentRepository=%23fileStore&include=DWRG1.*%5C.xml&maxMessagesPerPoll=10&noop=true&password=xxxxxx&readLock=changed&sortBy=file%3Amodified] cannot begin processing file: RemoteFile[/dwrg1/moved/DWRG1_2014-03-30T01h30Z.xml] due to: null. Caused by: [java.lang.NullPointerException - null]
> java.lang.NullPointerException
>         at
> org.apache.camel.component.file.remote.strategy.FtpChangedExclusiveReadLockStrategy.acquireExclusiveReadLock(FtpChangedExclusiveReadLockStrategy.java:83)
>         at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:49)
>         at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:35)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:326)
>         at
> org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
>         at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
>         at java.util.concurrent.Executors
> $RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
>         at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
>         at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:745)
>
>
> Someone can explain what happens?
>
> Regards
>
> Alberto
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/