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

11

20

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.

Short answered 23/11, 2012 at 2:6 Comment(0)
I
27

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}'`
Idyllist answered 2/5, 2013 at 20:20 Comment(2)
Your method of killing the process can be compacted to kill -9 `lsof -t -i tcp:8080`Pointless
On windows, the command to get the pid of the process that is using port 8080 is netstat -a -n -o | find "8080"Royston
D
8

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).

Desmid answered 18/11, 2013 at 14:6 Comment(0)
D
4

The message

Server failed to start for port 8080: Address already in use

indicates that some other process on your machine has already bound itself to port 8080. I would guess this is an instance of Tomcat running either because you started it or it didn't get properly shutdown by whatever IDE you use.

In any case, this question should help you end the process that is using the port.

As for the second error regarding script 8888, I have no idea. Grails does not attempt to start this script in my environment, so I imagine it is related to a plugin you have installed.

Dragnet answered 23/11, 2012 at 3:46 Comment(0)
D
3

The problem is the port number 8080 is already used. So, you either have to stop that process to make way for the new one or you can specify grails -Dserver.port=8090 run-app when you run your app.

However, since you're having a script error, it is possible that you didn't specify the port in your BuildConfig.groovy.

here's the solution: add grails.server.port.http=8888 in your BuildConfig.groovy

refer to a comment here: http://www.icodeya.com/2012/06/grails-resolving-server-failed-to-start.html

Dorset answered 23/11, 2012 at 5:53 Comment(0)
W
3

HOW TO KILL A BUSY PORT

open command prompt and type in C:>netstat -a -n -o | find "8080" find the PID of the port example TCP 0.0.0.0:8888 0.0.0.0:0 LISTENING 9068

next

C:>taskkill /PID 9068 /F SUCCESS: The process with PID 9068 has been terminated.

Wieche answered 29/7, 2016 at 15:20 Comment(0)
F
1

If you are using STS or Eclipse (or probably any environment built on Eclipse), one option is to go to the Debug perspective (Window -> Open perspective -> Debug). From there you can right click on your running server and click Terminate and relaunch. This will kill the current server and relaunch on the same port so that you do not get the Server failed to start for port 8080: Address already in use message.

As for the Error executing script 8888: For input string: "" I have not seen it before but it seems @ShootingStar has an answer.

Furnary answered 20/6, 2013 at 18:40 Comment(0)
I
1

When the port number 8080 is already used and you want to reuse the same port , you should kill its process : Use fuser 8080/tcp will print you PID of process bound on that port.

And this fuser -k 8080/tcp will kill that process.

Woks on Linux only. More universal is use of lsof -i4 (or 6 for IPv6).

EXAMPLE: if the port is 8080,Run on terminal :

 fuser -k -n tcp 8080

That is it!

Idyllist answered 8/7, 2013 at 22:27 Comment(0)
P
1

It means that there is a service using the port 8080. You can type on the terminal the command "netstat" to verify it.

How to stop a service using this port? On windows you can stop such service with these steps:

  1. Lon on to your system as Administrator
  2. From the START menu, select CONTROL PANEL, then ADMINISTRATIVE TOOLS, then SERVICES.
  3. From the list, find a service with a name ending in: Web Server and stop it.

If it is not running as a service, you may need to use the Task Manager to force it to stop.

Pottle answered 17/7, 2019 at 15:34 Comment(0)
B
0

Easier than other posted answers.

In the console window there is a X and XX icon. When you hover the cursor over it. You'll see balloons showing "Remove Launch" and "Remove All Terminated Launches".

Click them both. Eclipse will clear out all the existing servers so you can relaunch you server on the your default port.

Barham answered 1/4, 2014 at 11:53 Comment(0)
F
0

You need to kill the process which is running on port 8080; So use the command:

netstat -plten |grep java

used grep java as tomcat uses java as their processes.

It will show the list of processes with port number and process id

tcp6       0      0 :::8080                 :::*                    LISTEN      
1000       30070621    16085/java

the number before /java is a process id. Now use kill command to kill the process

kill -9 16085

-9 implies the process will be killed forcefully.

Flieger answered 12/10, 2015 at 9:59 Comment(0)
S
0

You can check if the 8080 port is using currently.

sudo lsof -i :8080

Then you can see the port status including COMMAND, PID, USER and something like that.

Then, You can terminate it with the PID.

kill -9 <PID>
Seldun answered 1/1, 2021 at 7:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.