在本地模式下运行的Twitter风暴示例无法删除文件

时间:2013-05-20 21:34:31

标签: apache-storm apache-zookeeper

我正在运行风暴启动项目(https://github.com/nathanmarz/storm-starter),并在运行一段时间后抛出以下错误。

23135 [main] ERROR org.apache.zookeeper.server.NIOServerCnxn  - Thread Thread[main,5,main] died 
java.io.IOException: Unable to delete file: C:\Users\[user directory]\AppData\Local\Temp\a0894222-6a8a-4f80-8655-3ad6a0c10021\version-2\log.1
    at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1390)
    at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
    at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
    at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1381)
    at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
    at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
    at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1381)
    at backtype.storm.util$rmr.invoke(util.clj:413)
    at backtype.storm.testing$kill_local_storm_cluster.invoke(testing.clj:164)
    at backtype.storm.LocalCluster$_shutdown.invoke(LocalCluster.clj:32)
    at backtype.storm.LocalCluster.shutdown(Unknown Source)
    at storm.starter.ExclamationTopology.main(ExclamationTopology.java:82)

我尝试更改“AppData”目录的权限,但这似乎不会影响它。这个错误会在命令行以及eclipse中运行。

1 个答案:

答案 0 :(得分:10)

根据此File delete problem on Windows,此问题仍存在于风暴版本0.8.2中。截至目前,以下解决方案对我有用。您可能需要注释掉cluster.killTopology() and cluster.shutdown()方法,如下所示,以避免文件删除错误。

 LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("test", conf, builder.createTopology());
        Utils.sleep(10000);
       // cluster.killTopology("test");
       // cluster.shutdown();  

希望,这有帮助