Nov 1, 2018

How to fix: jenkins dead but pid file exists

In the log /var/log/jenkins/jenkins.log, it shows:

SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:209)
at winstone.Launcher.<init>(Launcher.java:149)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at Main._main(Main.java:293)
at Main.main(Main.java:98)
Caused by: java.lang.NoClassDefFoundError: sun/security/x509/CertAndKeyGen
at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:101)
at winstone.Launcher.spawnListener(Launcher.java:207)
... 8 more
Caused by: java.lang.ClassNotFoundException: sun.security.x509.CertAndKeyGen
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more

If you switch to JDK 7, the problem disappears.

Check the status of this issue: Jenkins 1.586 not starting up using Java8

From: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins

System requirement
Jenkins requires Java7 or above to function. Java8 is recommended. Jenkins requires a fair amount of memory to operate well. Smaller installations should start around 256MB-1GB.

You can choose to run Jenkins on http, and then connect to Jenkins by SSH tunnel.