无法设置我自己的斯坦福 CoreNLP 服务器,并出现错误"Could not delete shutdown key file"



我尝试按照官方指南设置自己的斯坦福CoreNLP服务器。但是,我无法使用以下命令启动服务器:

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

我粘贴下面的错误消息:

my_server_name$ java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - setting default constituency parser
[main] INFO CoreNLP - warning: cannot find edu/stanford/nlp/models/srparser/englishSR.ser.gz
[main] INFO CoreNLP - using: edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz instead
[main] INFO CoreNLP - to use shift reduce parser download English models jar from:
[main] INFO CoreNLP - http://stanfordnlp.github.io/CoreNLP/download.html
Exception in thread "main" java.lang.IllegalStateException: Could not delete shutdown key file
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.<init>(StanfordCoreNLPServer.java:195)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.main(StanfordCoreNLPServer.java:1323)
[Thread-0] INFO CoreNLP - CoreNLP Server is shutting down.

主要问题是非法状态异常:无法删除关闭密钥文件。我只是想知道这个问题的原因是否是 sudo 访问。官方指南没有明确说明此命令需要 sudo 访问权限。

我想问 1( 上述命令是否需要 sudo 访问权限和 2( 如果该命令不需要 sudo 访问权限,我的 IllegalSstateException 的潜在错误可能是什么。

谢谢。

PS:我正在运行装有 Ubuntu 16.04.3 LTS 的服务器。

当文件系统上已存在关闭密钥文件、您正在启动新的 CoreNLP 服务器实例并且它无法删除旧的关闭密钥文件时,会发生此错误。您是否以两个不同的用户身份运行服务器?

更一般地说,您是否有权访问存储在 java 属性java.io.tmpdir中的目录?传统上,这在 Linux 机器上/tmp。关机密钥存储在:

System.getProperty("java.io.tmpdir") + File.separator + "corenlp.shutdown"

因此,对于 Linux 系统:

/tmp/corenlp.shutdown

该错误指出此文件存在,并且无法由 Java 删除。您应该检查对此文件的权限,这应该可以帮助您调试错误。

在最坏的情况下,一个简单的解决方法是在启动服务器时自行设置 tmpdir。例如:

java -Djava.io.tmpdir=/path/to/tmp -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer 9000

相关内容

最新更新