我正在尝试在Jenkins
端口上切换https
,但是我收到以下错误消息,并且Jenkins
无法启动
java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:209)
at winstone.Launcher.<init>(Launcher.java:150)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:312)
at Main.main(Main.java:136)
Caused by: winstone.WinstoneException: Error getting the SSL context object
at winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:216)
at winstone.HttpsConnectorFactory.createConnector(HttpsConnectorFactory.java:56)
at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:41)
at winstone.Launcher.spawnListener(Launcher.java:207)
... 8 more`
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(Unknown Source)
at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(Unknown Source)
at sun.security.provider.KeyStoreDelegator.engineGetKey(Unknown Source)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(Unknown Source)
at java.security.KeyStore.getKey(Unknown Source)
at sun.security.ssl.SunX509KeyManagerImpl.<init>(Unknown Source)
at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(Unknown Source)
at javax.net.ssl.KeyManagerFactory.init(Unknown Source)
at winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:183)
我创建了一个新的keystore
,并且在keystore
内导入了p12
证书。
keystore
可能有问题吗? Jenkins
对keystore
的期望是什么?我是否需要在keystore
中导入公共证书?
答案 0 :(得分:0)
当我的 p12 和 jks 有 2 个不同的密码时,我也遇到了这个问题。 (我从私钥和自签名证书开始,然后将我的密钥和证书转换为 p12 格式存储,最后将 p12 转换为 jks 文件)
Caused by: winstone.WinstoneException: Error getting the SSL context object
at winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:229)
at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:63)
at winstone.Launcher.spawnListener(Launcher.java:220)
... 8 more Caused by: java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:315)
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:143)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:57)
at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:71)
at java.security.KeyStore.getKey(KeyStore.java:1023)
at sun.security.ssl.SunX509KeyManagerImpl.<init>(SunX509KeyManagerImpl.java:145)
at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(KeyManagerFactoryImpl.java:70)
at javax.net.ssl.KeyManagerFactory.init(KeyManagerFactory.java:256)
at winstone.AbstractSecuredConnectorFactory.getSSLContext(AbstractSecuredConnectorFactory.java:190)
... 10 more 2021-03-27 05:38:15.911+0000 [id=1] SEVERE winstone.Logger#logInternal: Container startup failed java.security.UnrecoverableKeyException: Cannot recover key
at sun.security.provider.KeyProtector.recover(KeyProtector.java:315)
at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:143)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:57)
我为 p12 和 jks 应用了相同的密码,然后尝试并可以摆脱或出现此错误。