Jetty – java.net.BindException: Address already in use

Start a Java webapp with Maven Jetty plugin.


$ mvn jetty:run

1. Problem

But it hits the following error messages :

[WARNING] FAILED org.eclipse.jetty.maven.plugin.JettyServer@1f53481b:
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.open(ServerConnector.java:321)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
//...

2. Solution

By default, the maven-jetty-plugin start Jetty on port 8080, the above error said the port 8080 is already in use by another application.

To fix it

  1. Find out which program is using port 8080 and kill it. See this Linux – Who is using port 8080
  2. Start Jetty on another port : mvn -Djetty.port=8888 jetty:run

References

  1. Maven Jetty Plugin
  2. Configuring the Jetty Maven Plugin

2 comments on “Jetty – java.net.BindException: Address already in use

Leave a Comment

Your email address will not be published. Required fields are marked *