2

When I try to run my (local) play application via the play2 plugin from intellij I get:

[ERROR] [06/03/2017 23:21:10.985] [play-dev-mode-akka.actor.default-dispatcher-2] [akka://play-dev-mode/system/IO-TCP/selectors/$a/0] Bind failed for TCP channel on endpoint [/0.0.0.0:80]
java.net.SocketException: Permission denied
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at akka.io.TcpListener.liftedTree1$1(TcpListener.scala:56)
    at akka.io.TcpListener.<init>(TcpListener.scala:53)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at akka.util.Reflect$.instantiate(Reflect.scala:65)
    at akka.actor.ArgsReflectConstructor.produce(IndirectActorProducer.scala:96)
    at akka.actor.Props.newActor(Props.scala:213)
    at akka.actor.ActorCell.newActor(ActorCell.scala:555)
    at akka.actor.ActorCell.create(ActorCell.scala:581)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:454)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:476)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)
    at akka.dispatch.Mailbox.run(Mailbox.scala:223)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
    at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

akka.stream.BindFailedException$: bind failed

If however, I run it via sbt run, everything works like a charm.

1) Why is that? 2) How can I fix this? (Running on Linux 4.11 here - I understand that the port is only allowed "sudoers", but then I wonder why the sbt-way works) 3) Any other way to run play in "debug mode"? I would like to set some break points and analyze the flow.

2 Answers2

0

I ran into similiar issues before. Deploying to port requires permissions, if you want to strt the service on local, you can change the port to 9000, if you don'5 want this issue to occur. Then, when you deploy on production, you can change it to 80 and follow this guide :

https://www.playframework.com/documentation/2.5.x/Deploying

Sam Upra
  • 737
  • 5
  • 12
  • But I don't want to "deploy" in the sense that it is production ready. I want the same as `sbt run` does –  Jun 04 '17 at 19:10
  • Yes, I know, I am just offering you an alternative. You can have two different configurations, one for local with port 9000, and one for production with port 80, which is what I meant. By the way, here is one full thread about this. You can use port 8080 for local as well : https://stackoverflow.com/questions/8205067/how-do-i-change-the-default-port-9000-that-play-uses-when-i-execute-the-run – Sam Upra Jun 04 '17 at 19:25
  • My `sbt run` already deploys on port 9000. Just the play2 plugin does not but tries port 80 for some unknown reason. I am sorry, I can't follow you. –  Jun 04 '17 at 19:33
  • I see, I'm sorry I misunderstood. – Sam Upra Jun 04 '17 at 21:19
0

If you have changed build.sbt to listen on port 80, remove that line. IntelliJ still thinks app wants to run on 80

And also:

If you have changed application.conf, make sure port is not set to 80.

stack_ved
  • 721
  • 3
  • 11