scalathriftfinagle

Finagle Thrift NoSuchMethodError


I´m using Finagle thrift but when I build the server and service

  val service = new EchoService$FinagleService(new EchoServiceImpl, new TBinaryProtocol.Factory())

  val server = Thrift.server.serveIface("localhost:8080", service)

And I run it I receiving the exception:

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)

Solution

  • I think you should either call

    val service = new EchoService$FinagleService(new EchoServiceImpl, new TBinaryProtocol.Factory())
    val server = Thrift.server.serve("localhost:8080", service)
    

    or

    val server = Thrift.server.serveIface("localhost:8080", EchoServiceImpl)
    

    But I don't think this could resolve the NoSuchMethodError, it seems like a version compatibility problem. I would first check Finagle version and Scrooge version, make sure they are on the same page.