finagle
finagle copied to clipboard
ZkOffer(/s/test/server)" java.lang.NoSuchMethodError
Hi gays :
1.I use java(1.8) and finagle (6.26 version) to test service discovery but get some exception.
2.Cat add some demo or documents for how to use the finagle-serversets
Client code
Service<Request, Response> service =ClientBuilder.safeBuild(
ClientBuilder.get().codec(Http.get())
.hostConnectionLimit(1)
.dest("zk!localhost:2181!/test/server")
.failFast(true)
.retries(1));
Future<Response> response= service.apply(Request.apply("/"))
.onSuccess(new AbstractFunction1<Response, BoxedUnit>() {
public BoxedUnit apply(Response v1) {
System.out.println(v1.contentString());
return null;
}
}).onFailure(new AbstractFunction1<Throwable, BoxedUnit>() {
public BoxedUnit apply(Throwable v1) {
v1.printStackTrace();
return null;
}
});
Await.ready(response);
Exception
Exception in thread "ZkOffer(/s/test/server)" java.lang.NoSuchMethodError: com.twitter.common.zookeeper.ServerSet.watch(Lcom/twitter/common/net/pool/DynamicHostSet$HostChangeMonitor;)Lcom/twitter/common/base/Command;
at com.twitter.finagle.zookeeper.ZkOffer.run(ZkResolver.scala:55)
finagle version 6.26.0_2.11
NoSuchMethodError is a common error when there's a version mismatch, or there's a caching problem for your artifacts. Sorry it took so long to get back to you! I hope you were able to solve your problem.