Jenkins- java.net.BindException: Address already in use

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
Jenkins-error

Command used to start Jenkins :-

  1. Open Console.
  2. Go to the folder containing jenkins war.
  3. Run this command java -jar jenkins.war
  4. This will run Jenkins on local host with default port i.e. 8080
  5. 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.

Author: Khyati Sehgal

Khyati has more than 12 years of experience in quality assurance engineering. Khyati has worked extensively on Manual and Automation testing of various technologies and domains like data quality. From last 6 years, She is leading QA Activities on Agile/Scrum projects while continuously contributing in playing role as a Scrum master, continuous integration, iteration planning, facilitating requirement analysis and closure. On automation front, She has explored gui, web services and mobile automation. Tools/ Technologies used:- Selenium/WebDriver, Core Java, JUnit, TestNG, Maven, SoapUI. Jenkins, Appium, Selenium backed and selenium remote driver. Have delve into android phone/tab of verison upto 6 (marshmallow), ios phone/i pad, and mobile websites

12 thoughts on “Jenkins- java.net.BindException: Address already in use”

  1. I visit each day a few sites and blogs to read content, but this blog offers quality based writing. I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I’m quite certain I will learn lots of new stuff right here! Best of luck for the next!

    Like

  2. I visit each day a few sites and blogs to read content, but this blog offers quality based writing. I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I’m quite certain I will learn lots of new stuff right here! Best of luck for the next!

    Like

Leave a comment