user7120361
user7120361

Reputation:

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

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?

Upvotes: 9

Views: 6890

Answers (2)

Basavaraj Hadimani
Basavaraj Hadimani

Reputation: 1104

sudo lsof -i : <port>

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

kill -9 <pId>

Upvotes: 0

Salem
Salem

Reputation: 12986

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

Upvotes: 7

Related Questions