Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails: Resolving "Server failed to start for port 8080: Address already in use."

Tags:

I'm getting this error when trying to resolve "Server failed to start for port 8080: Address already in use"

 Error executing script 8888: For input string: ""

Can anybody help? Don't know what's wrong. Thanks.

like image 233
eggplant_roll Avatar asked Nov 23 '12 02:11

eggplant_roll


People also ask

What is the main reason for server failed to start for port 8080?

error occurs because port 8080 is already configured with another application, or port 8080 has not been released yet. The spring boot application is trying to configure port 8080 to start a web server. Since the port can not be used, this error is thrown.


2 Answers

When the port number 8080 is already used and you want to reuse the same port , you should kill its process :

First, check the pid of the process that is using port 8080. To do this run:

lsof -w -n -i tcp:8080

Result after running Command

In the example above, the pid is 3812 for process that is using port 9090

Take note of the PID. The PID could be different on your machine. We need this for executing the next command: kill process

so you will have to test it via run-app:

grails run-app

UPDATE : As the output of lsof -w -n -i tcp:8080| awk '{print $2}'|awk 'END{print}' is the PID , You can kill the port process by PID automatically :

 kill -9 `lsof -w -n -i tcp:8080| awk '{print $2}'|awk 'END{print}'`
like image 103
Abdennour TOUMI Avatar answered Mar 23 '23 00:03

Abdennour TOUMI


If you're using Grails/Groovy Tool Suite ( Eclipse based IDE ), select Run as > Run Configurations.... Then, in Grails tab, input like this :

-Dserver.port=8050 run-app

So, Grails will run on port 8050 instead of the default port (8080).

like image 25
Phat H. VU Avatar answered Mar 22 '23 22:03

Phat H. VU