报错详情:
java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()Lcom/google/common/util/concurrent/ListeningExecutorService;
at org.apache.curator.framework.listen.ListenerContainer.addListener(ListenerContainer.java:40)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:254)
at org.apache.sentry.provider.db.service.persistent.HAContext.startCuratorFramework(HAContext.java:160)
at org.apache.sentry.provider.db.service.persistent.HAContext.(HAContext.java:115)
at org.apache.sentry.provider.db.service.persistent.HAContext.getHAContext(HAContext.java:126)
at org.apache.sentry.service.thrift.HAClientInvocationHandler.renewSentryClient(HAClientInvocationHandler.java:93)
at org.apache.sentry.service.thrift.HAClientInvocationHandler.invokeImpl(HAClientInvocationHandler.java:67)
报错信息提示,com.google.common.util.concurrent.MoreExecutors 这个类中没找到 sameThreadExecutor 方法,经验证,确实没有这个方法。
但之前是好的,怎么突然就不好了呢。。。
定位了一下,发现 MoreExecutors 这个类是 com.google.guva-27.0.1-jre.jar 这个包里的,根据 pom.xml 文件的修改记录,发现是另一个同事在我后面添加了这个类库。
而我的接口底层是基于 Apache Sentry 的,这里用到了一个库 curator-framework-2.60.jar。
看起来就是这两者兼容性引起的。
移除 com.google.guva-27.0.1-jre 依赖后问题解决。