连接ElasticSearch获取客户端client时报错

 

连接ElasticSearch时报错

2016-12-16 17:42:21  [ main:0 ] - [ org.elasticsearch.plugins.PluginsService:180]  [Rachel Summers] modules [], plugins [], sites []
Exception in thread "main" java.lang.VerifyError: (class: org/jboss/netty/channel/socket/nio/NioWorkerPool, method: newWorker signature: (Ljava/util/concurrent/Executor;)Lorg/jboss/netty/channel/socket/nio/AbstractNioWorker;) Wrong return type in function
	at org.elasticsearch.transport.netty.NettyTransport.createClientBootstrap(NettyTransport.java:344)
	at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:279)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.transport.TransportService.doStart(TransportService.java:182)
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
	at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:162)
	at canal.canal2es.TestEs.main(TestEs.java:20)


如果是使用canal或dts等其他使用netty的依赖,可能会报以上错误,原因是netty的jar包冲突。

解决方法如下:

maven 项目,打开pom.xml,点击下面dependency Hierarchy视图,选中netty jar包。会显示引用他的层级。然后查看,如果不是elasticSearch引用的,则排除他的引用。右键netty,选择Exclude Maven Artifact...,点击OK就排除了这个jar依赖。然后再重新运行下就OK了

连接ElasticSearch获取客户端client时报错_第1张图片

你可能感兴趣的:(elasti_csearch)