Elasticsearch Exception:Message not fully read (response) for requestId
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch Exception:Message not fully read (response) for requestId相关的知识,希望对你有一定的参考价值。
本地使用Netty+Elasticsearch测试表单请求查询数据,无异常。将工程打包上传至服务器运行,页面请求后发生异常,连接关闭。
事件:前台通过Netty请求资源,Netty后台通过前台请求的JSON向ES查询数据,发生异常。
异常状况:
21:39:46,019 WARN org.elasticsearch.transport.netty:752 - [Jeanne-Marie Beaubier] exception caught on transport layer [[id: 0x8ed9a041, /xx.xx.xx.xxx:37506 => /xx.xx.xx.xx:9300]], closing connection java.lang.IllegalStateException: Message not fully read (response) for requestId [120], handler [[email protected]], error [false]; resetting at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:145) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) at org.jboss.netty.channel.socket.nio.AbstractNioselector.run(AbstractNioSelector.java:337) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
原因:本地Maven配置中引入Elasticsearch 2.1.0依赖以及Netty依赖,工程运行时,Elasticsearch底层会调用netty相关接口,而服务器中的Elasticsearch(2.1.0)在后台运行,其也会启动加载netty相关服务。两者同时存在,导致数据传输时出现问题。
解决办法:工程通过Maven打jar包时,排除Elasticsearch的相关jar包,只将其他依赖jar包打入。在服务器上运行时,通过设置class_path以及cp命令将服务器的ES相关jar包依赖导入,重新运行,即可。
服务器.sh文件的更改配置:
CLASS_PATH=$APP_HOME/ES-NETTY-WEB-0.0.0-beta.jar:/usr/local/elasticsearch/lib/*
JAVA_CMD="nohup $JAVA_HOME/bin/java $JAVA_OPTS -cp $CLASS_PATH $APP_MAINCLASS $APP_HOME/config.properties >/dev/null 2>&1 &"
本文出自 “不忘初心” 博客,请务必保留此出处http://zh9526.blog.51cto.com/3051209/1758069
以上是关于Elasticsearch Exception:Message not fully read (response) for requestId的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearch 学习笔记 Elasticsearch及Elasticsearch head安装配置