使用NIO Files.delete()删除文件时出现Java文件系统异常

时间:2015-04-28 00:20:29

标签: java spring-batch spring-integration nio

我得到以下异常,

java.nio.file.FileSystemException: C:\Users\abcd.zip: The process cannot access the file because it is being used by another process.

    at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) ~[na:1.7.0_75]
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[na:1.7.0_75]
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[na:1.7.0_75]
    at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source) ~[na:1.7.0_75]
    at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source) ~[na:1.7.0_75]
    at java.nio.file.Files.deleteIfExists(Unknown Source) ~[na:1.7.0_75]

据我所知,此文件当前是由另一个进程打开的,但是如何找出哪个进程锁定了这个?我在弹簧集成和弹簧批处理中使用此代码,一旦从ftp服务器下载文件,它将被传送到变换器以将弹簧集成消息转换为作业启动请求。

0 个答案:

没有答案