0

I just stopped running a Scala Spray executable on an EC2 Ubuntu instance to launch a newer version of the app. When I try and run the new executable I get the following error:

ubuntu@ip-172-32-92:~/suredbits-dfs$ ./target/universal/stage/bin/suredbits-dfs [WARN] [08/14/2015 03:22:30.314] [NflDbApiActorSystemConfig-akka.actor.default-dispatcher-5] [akka://NflDbApiActorSystemConfig/user/IO-HTTP/listener-0] Bind to ec2-52-116-195.us-west-2.compute.amazonaws.com/172.32.92:80 failed

I have checked to make sure port 80 is open and available by running this command:

netstat -anp | grep 80

which doesn't return anything. It seems that my port is open, and Scala Spray is just failing to bind again. Here is how I am attempting to start my server in my executable:

package com.suredbits.dfs

/**
 * Created by chris on 8/9/15.
 */

import akka.actor.ActorSystem
import com.github.nfldb.config.{NflDbApiActorSystemConfig, NflDbApiDbConfig}
import com.suredbits.dfs.nfl.scoring.NflPlayerScoringService
import spray.routing.SimpleRoutingApp

object Main extends App with SimpleRoutingApp with NflPlayerScoringService
  with NflDbApiDbConfig with NflDbApiActorSystemConfig {

  import actorSystem._

/*  startServer(interface = "localhost", port = 80) {
    path("hello") {
      get {
        complete {
          <h1>Say hello to spray</h1>
        }
      }
    } ~ nflPlayerScoringServiceRoutes
  }*/

  startServer(interface = "ec2-52-116-195.us-west-2.compute.amazonaws.com", port = 80) {
    path("hello") {
      get {
        complete {
          <h1>Say hello to spray</h1>
        }
      }
    } ~ nflPlayerScoringServiceRoutes
  }
}
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60

1 Answers1

1

Start the process with sudo:

sudo ./target/universal/stage/bin/suredbits-dfs

Why? You are trying to use a privileged port (a port under 1024). Only root has access to those ports. The clue that tipped me off to this was that you checked netstat and nothing else was on port 80.

tedder42
  • 23,519
  • 13
  • 86
  • 102