Jetty java.net.BindException: Address already in use
By:Roy.LiuLast updated:2019-08-17
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
- Find out which program is using port 8080 and kill it. See this Linux – Who is using port 8080
- Start Jetty on another port : mvn -Djetty.port=8888 jetty:run
References
From:一号门
COMMENTS