Looks like you are trying to copy file to HDFS in a shutdown hook. Since you can't control the order in which shutdown hooks run, this is won't work. There is a patch to allow Hadoop's FileSystem shutdown hook to be disabled so it doesn't close filesystems on exit. See https://issues.apache.org/jira/browse/HADOOP-4829.
Cheers, Tom On Tue, May 19, 2009 at 8:44 AM, Stas Oskin <stas.os...@gmail.com> wrote: > Hi. > > Does anyone has any idea on this issue? > > Thanks! > > 2009/5/17 Stas Oskin <stas.os...@gmail.com> > >> Hi. >> >> I have an issue where my application, when shutting down (at ShutdownHook >> level), is unable to copy files to HDFS. >> >> Each copy throws the following exception: >> >> java.lang.IllegalStateException: Shutdown in progress >> at >> java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39) >> at java.lang.Runtime.addShutdownHook(Runtime.java:192) >> at >> org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1353) >> at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:213) >> at >> org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:189) >> at >> org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1185) >> at >> org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1161) >> at >> org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1133) >> at app.util.FileUtils.copyToCluster(FileUtils.java:392) >> >> >> I read some reports, including this one ( >> https://issues.apache.org/jira/browse/HADOOP-3818), but there was no >> definite answer how to do it. >> >> Is there any good solution to this issue? >> >> Thanks in advance. >> >