Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start Jenkins on https

I'm trying to switch Jenkins on https port,but i'm receiving the following errors and Jenkins cannot be started

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)

I created a new keystore and inside the keystore i have imported a p12 certificate. Probably something is wrong with the keystore? What Jenkins expects in the keystore? Do i need to import a public certificate in the keystore?

like image 596
Svetoslav Angelov Avatar asked Oct 16 '22 10:10

Svetoslav Angelov


1 Answers

I also ran in to the this issue while having 2 different passwords for my p12 and jks. ( I started with a private key and a self signed certificate, then converted my key and cert in to a p12 format store, finally converted p12 to a jks file )

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)

I applied the same password for p12 and jks and then attempted and could got rid or this error.

like image 176
Shan Siriwardana Avatar answered Nov 13 '22 00:11

Shan Siriwardana