我正在使用Finagle节俭,但是当我构建服务器和服务时
val service = new EchoService$FinagleService(new EchoServiceImpl, new TBinaryProtocol.Factory())
val server = Thrift.server.serveIface("localhost:8080", service)
我运行它收到例外:
Exception in thread "main" java.lang.NoSuchMethodError: com.twitter.finagle.server.StackServer.$init$(Lcom/twitter/finagle/server/StackServer;)V
at com.twitter.finagle.Thrift$Server.<init>(Thrift.scala:417)
Disconnected from the target VM, address: '127.0.0.1:60647', transport: 'socket'
at com.twitter.finagle.Thrift$.server(Thrift.scala:495)
我想你应该打电话
val service = new EchoService$FinagleService(new EchoServiceImpl, new TBinaryProtocol.Factory())
val server = Thrift.server.serve("localhost:8080", service)
要么
val server = Thrift.server.serveIface("localhost:8080", EchoServiceImpl)
但我不认为这可以解决NoSuchMethodError,它似乎是版本兼容性问题。我首先检查Finagle版本和Scrooge版本,确保它们在同一页面上。