Continuous Integration, Java, Jenkins, SubVersion, Uncategorized, version control

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

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 up and be running if everything is fine and error otherwise.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s