运行finch / finagle应用程序时的AbstractMethodError

时间:2017-04-23 02:41:13

标签: scala web-services finagle

我正在尝试运行我的应用程序并收到此错误:

java.lang.AbstractMethodError: com.twitter.finagle.stats.MetricsStatsReceiver

我的代码是:

object Main extends TwitterServer {

  implicit val objectMapper: ObjectMapper = ObjectProvider.objectMapper

  val appConf = ConfigFactory.load()

  def main(): Unit = {
    statsReceiver.counter("posts")
    statsReceiver.counter("login")
    // configuration
    val port = appConf.getInt("8090")
    val db = new CommDb()
    val service = Api.makeService(db)
val server = Http.serve(":8080", service) //creates service

  def close(): Future[Unit] = {
    Await.ready(server.close())
  }
    Await.ready(server)
  }
}

这可能是一个错误,所以我应该使用哪个版本的库,或者我可以切换到更稳定的Web服务库。

我看到其他人遇到同样的问题:

https://gist.github.com/edwelker/33e60108d62613434680ec13aa265611

更新

      "com.github.finagle" %% "finch-core" % "0.14.0",
      "com.github.finagle" %% "finch-circe" % "0.14.0",
      "com.tokbox" % "opentok-server-sdk" % "3.0.0-beta.2",
      "com.google.firebase" % "firebase-server-sdk" % "3.0.1",
  "org.scalatest" %% "scalatest" % "2.2.5" % "it,test",
"ch.qos.logback" % "logback-classic" % "1.1.7",
      "com.github.finagle" %% "finch-jackson" % "0.14.0",
      "com.github.finagle" %% "finch-test" % "0.14.0" % "it,test",
      "com.softwaremill.macwire" %% "macros" % "2.2.3" % "provided",
      "com.softwaremill.macwire" %% "util" % "2.2.3",
      "com.softwaremill.macwire" %% "proxy" % "2.2.3",
      "com.twitter" %% "finagle-stats" % "6.35.0",
      "com.twitter" %% "twitter-server" % "1.20.0",
      "com.twitter" %% "util-eval" % "6.34.0",
      "com.typesafe" % "config" % "1.3.0",
      "org.slf4j" % "slf4j-api" % "1.7.21",
      "org.slf4j" % "jul-to-slf4j" % "1.7.21",
      "org.slf4j" % "jcl-over-slf4j" % "1.7.21",
      "org.slf4j" % "log4j-over-slf4j" % "1.7.21",
      "org.scalactic" %% "scalactic" % "2.2.5" % "it,test",
      "org.scalacheck" %% "scalacheck" % "1.13.1" % "it,test",
      "ru.arkoit" %% "finchrich-controller" % "0.1.1"

1 个答案:

答案 0 :(得分:1)

正如Alexey在评论中提到的,这是一个依赖性不匹配问题。 sbt-dependency-graph是一个有用的工具,可以确保所有库都依赖于相同的版本。