Error running the project in Play Framework. Failed to listen to port :9000
Asked Answered
T

2

9

I am trying to run my Play2 project. When I type activator run in my terminal, it is loading and finally gives me this error message:

p.c.s.NettyServer - Failed to listen for HTTP on /0.0.0.0:9000!

but I have not set anything on this port and I have no background processes in my terminal. Why this error appears to me?

Trochanter answered 25/1, 2017 at 18:34 Comment(2)
Try to run it using ./activator "run 9876"? It starts?Ergosterol
It started. Thanks!Trochanter
E
7

As you are able to start it using another port, it means that something is really using that port. It may be a different application or a previously stalled start of activator/play.

To find out what is using it you can use for example lsof in Linux:

$ lsof -i :9000

Once you find its pid you can stop that process.

If that port is used by another service and you really need it, instead of providing always the port to the run command, you can try to add to your sbtopts (either in ~/.sbtopts file or SBT_OPTS env var) this:

-Dhttp.port=9876
Ergosterol answered 25/1, 2017 at 21:34 Comment(4)
Thank you! Is there a command to end all the processes on the port?Trochanter
you can use kill -9 <pid>Olympian
what represents -9?Trochanter
-9 is the type of signal being sent to the process, linuxjournal.com/article/1332Ramsay
B
0
sudo lsof -i : <port>

then you get pId (consilder only java pId), run below command

kill -9 <pId>
Becca answered 14/2, 2019 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.