【问题标题】:Scala spray failing to bind to EC2 Public DNSScala Spray 无法绑定到 EC2 公共 DNS
【发布时间】:2015-08-14 23:36:17
【问题描述】:

我刚刚停止在 EC2 Ubuntu 实例上运行 Scala Spray 可执行文件,以启动更新版本的应用程序。当我尝试运行新的可执行文件时,出现以下错误:

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

我已通过运行以下命令检查以确保端口 80 已打开且可用:

netstat -anp | grep 80

不返回任何东西。看来我的端口是打开的,而 Scala Spray 只是再次绑定失败。以下是我尝试在可执行文件中启动服务器的方式:

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
  }
}

【问题讨论】:

  • 尝试启用应该报告底层错误的调试日志记录。
  • 尝试使用sudo运行。
  • @tedder42 这就是问题所在,如果你想写一篇文章,我会将问题奖励给你。
  • @ChrisStewart 完成 - 在我知道它是否有帮助之前,我不想做一个完整的答案。

标签: scala amazon-web-services amazon-ec2 dns spray


【解决方案1】:

sudo开始这个过程:

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

为什么? You are trying to use a privileged port(1024以下的端口)。只有 root 可以访问这些端口。提示我这一点的线索是您检查了netstat,但端口 80 上没有其他内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-23
    • 2012-07-31
    • 2023-03-28
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多