#Use an Ubuntu base image
FROM ubuntu:latest
#Update packages
RUN apt-get update
#Install Java
RUN apt-get install -y default-jre
#Install wget to download files
RUN apt-get install -y wget
#Download Stanford CoreNLP
RUN wget https://nlp.stanford.edu/software/stanford-corenlp-4.5.6.zip
#Unzip Stanford CoreNLP
RUN apt-get install -y unzip
RUN unzip stanford-corenlp-4.5.6.zip
#Set the working directory to the unzipped CoreNLP directory
WORKDIR /stanford-corenlp-4.5.6
#Expose port 9000 for CoreNLP server
EXPOSE 9000
#Start Stanford CoreNLP server
CMD java -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000 -ssl -key /tmp/corenlp/corenlp.jks
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - Server default properties:
(Note: unspecified annotator properties are English defaults)
inputFormat = text
outputFormat = json
prettyPrint = false
[main] INFO CoreNLP - Threads: 2
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - Adding SSL context to server; key=/tmp/corenlp/corenlp.jks
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: keystore password was incorrect
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.addSSLContext(StanfordCoreNLPServer.java:1644)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.run(StanfordCoreNLPServer.java:1734)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.launchServer(StanfordCoreNLPServer.java:1834)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.main(StanfordCoreNLPServer.java:1841)
Caused by: java.io.IOException: keystore password was incorrect
at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2097)
at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:249)
at java.base/java.security.KeyStore.load(KeyStore.java:1500)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.addSSLContext(StanfordCoreNLPServer.java:1619)
... 3 more
Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
... 7 more
[Thread-0] INFO CoreNLP - CoreNLP Server is shutting down.
3条答案
按热度按时间pgpifvop1#
请回退一点,并解释您是如何运行应用程序的?
mccptt672#
我遇到了同样的问题。
我构建了这个Dockerfile:
然后使用以下命令运行它:
sudo docker run -i -p 9000:9000 -v /home/path/to/jksfile/directory:/tmp/corenlp corenlp:latest
在位置上有一个jks文件。
/home/path/to/jksfile/directory/corenlp.jks
之前,我使用以下命令创建了这个jks文件:
keytool -importcert -file "mycertificate.cer" -keystore corenlp.jks -alias "corenlp"
运行这个命令时,我需要输入一个密码来保护这个.jks文件。
然后,当我尝试运行Docker容器时,我得到了与@mmeytin相同的错误:
qzwqbdag3#
更新:我找到了一个临时的解决方法:
看起来,抛出异常的那一行代码是尝试使用硬编码密码 "corenlp" 打开 .jks 文件。这意味着当你将你的 .jks 文件的密码也设置为 "corenlp" 时,它可以正确执行。然而,我建议要么将此信息包含在 API 文档中,要么在命令中添加一种提供 .jks 文件密码的方法。希望这对你有所帮助。