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.
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.
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
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:
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}'`
netstat -a -n -o | find "8080"
–
Royston 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).
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.
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
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.
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.
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!
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:
If it is not running as a service, you may need to use the Task Manager to force it to stop.
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.
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.
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>
© 2022 - 2024 — McMap. All rights reserved.
kill -9 `lsof -t -i tcp:8080`
– Pointless