nlp - 无法设置我自己的 Stanford CoreNLP 服务器,错误为 "Could not delete shutdown key file"

标签 nlp stanford-nlp

我尝试按照 official guide 设置我自己的 Stanford 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.

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

我想问 1) 上面的命令是否需要 sudo 访问权限,以及 2) 如果该命令不需要 sudo 访问权限,我的 IllegalSstateException 的潜在错误是什么。

谢谢。

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

最佳答案

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

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

 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

关于nlp - 无法设置我自己的 Stanford CoreNLP 服务器,错误为 "Could not delete shutdown key file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45886128/

相关文章:

php - 计算各种语言单词的 PHP 库/类?

Python 和 NLTK : Baseline tagger

nlp - 如何使用斯坦福情感分析数据集

java - 如何在 Eclipse/Netbeans IDE for Java NLP 项目中添加 stanford corenlp 库?

nlp - UIMA 只提供一个包装器还是像 StandfordCore NLP 和 GATE 一样?

postgresql - PostgreSQL 的 to_tsvector 函数可以返回标记/单词而不是词素吗?

python - 值错误 : operands could not be broadcast together with shapes in Naive bayes classifier

python - 如何不将整个单词 "king"匹配到 "king?"?

parsing - Stanford Parser : How to include the punctuations?

python - 判断一个词是否是名词