#1333·CoreNLP

Unable to use password-protected JKS keystore

Author: mmeytinCreated Jan 24, 2023Updated May 12, 2024

We attempted to use -ssl and -key options to establish SSL communication with the CoreNLP server per the documentation. The application crashes with exception below because it's not possible to pass a password for a password-protected Java keystore file. Is there another recommended method for enabling SSL-protected communication with the CoreNLP server? Thank you!

[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: 8
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - Adding SSL context to server; key=/shared/mykeystore.jks
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Keystore was tampered with, or password was incorrect
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.addSSLContext(StanfordCoreNLPServer.java:1435)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.run(StanfordCoreNLPServer.java:1525)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.launchServer(StanfordCoreNLPServer.java:1624)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.main(StanfordCoreNLPServer.java:1631)
Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
        at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:795)
        at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222)
        at java.base/java.security.KeyStore.load(KeyStore.java:1479)
        at edu.stanford.nlp.pipeline.StanfordCoreNLPServer.addSSLContext(StanfordCoreNLPServer.java:1410)
        ... 3 more
Caused by: java.security.UnrecoverableKeyException: Password verification failed
        at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:793)
        ... 6 more
[Thread-1] INFO CoreNLP - CoreNLP Server is shutting down.