Jenkins- java.net.BindException: Address already in use
- khyati sehgal
- Aug 26, 2014
- 1 min read
In this post, I will be sharing a solution of error which is very common while starting up Jenkins.
Aug 03, 2018 1:41:25 AM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:156)
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:498)
at Main._main(Main.java:312)
at Main.main(Main.java:136)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:334)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:302)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:238)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:154)
... 7 more

Command used to start Jenkins :-
Open Console.
Go to the folder containing jenkins war.
Run this command java -jar jenkins.war
This will run Jenkins on local host with default port i.e. 8080
Check by hitting the browser with this URL localhost:8080
Solution:-
This is an issue of using same address again while running Jenkins, should be solved by changing the port from the one already in use. For this one can use httpPort as an argument while deploying Jenkins war on the machine, like this:-
java -jar jenkins.war --httpPort=8081
Another way can be by killing the Jenkins server which is already running and start a new one.
Command- ps -ef | grep jenkins kill -9 “Instance id” Or CTRL+ SPACE to kill already running console.
Check the browser once again by hitting localhost:8080
This should show up Jenkins and be running if everything is fine and an error otherwise.
Comments