I'm running Jenkins on a Windows Server 2012 which runs ok, but I can't restart Jenkins e.g. after updating plugins.
The error I get in the jenkins.err.log is
SEVERE winstone.Logger#logInternal: Container startup failed
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:396)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:187)
Caused: java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:189)
at winstone.Launcher.main(Launcher.java:362)
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:375)
at Main.main(Main.java:151)
So apparently the port that Jenkins was running on (8080) is still in use after the restart.
The server console gives me this:
Child process [5424 - C:\Program Files (x86)\Jenkins\jre\bin\java -Xrs -Xmx512m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox; default-src 'none'; img-src 'self'; style-src 'self' 'unsafe-inline';" -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080 --ajp13Port=-1 --webroot="C:\Program Files (x86)\Jenkins\war"] finished with 1
I have checked which process is using port 8080 using netstat, but can't find anything. I know I can change the port when starting Jenkins using the "httpPort"-flag. Doing so (e.g. changing the port to 8081) will work - until I restart Jenkins again, this time 8081 will be in use (and also 8080 and all other ports I've been using before). This can only be resolved by restarting the server, then 8080 (and all other ports) will be available again.
Both "solutions" (1. keep changing the port, 2. restarting the server) are just tedious workarounds for me as I have to inform all colleagues which port is currently in use all the time or let administration restart the server over and over again. The flag "--ajp13Port=-1" is an attempt to get this fixed, I also tried disabling the "RunawayProcessKiller"-extension as suggested in another post, but both didn't change anything.
Any hint to get this fixed is much appreciated.