elasticsearch7.3 java客户端查询时报错Not a valid protocol version: This is not an HTTP port

  • A+
所属分类:全文检索

具体报错信息:

2019-09-26 09:59:11.593 ERROR 18836 --- [nio-8010-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: error while performing request] with root cause

org.apache.http.ParseException: Not a valid protocol version: This is not an HTTP port
  at org.apache.http.message.BasicLineParser.parseProtocolVersion(BasicLineParser.java:148) ~[httpcore-4.4.11.jar:4.4.11]
  at org.apache.http.message.BasicLineParser.parseStatusLine(BasicLineParser.java:366) ~[httpcore-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.codecs.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:112) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.codecs.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:50) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.codecs.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:156) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:207) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:245) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) ~[httpasyncclient-4.1.4.jar:4.1.4]
  at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar:4.1.4]
  at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.11.jar:4.4.11]
  at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]

google了下,发现是端口的问题,我用的是9200端口,但是我用的是最新版本推荐的rest-high-level-client,所以需要用9300这个端口,修正端口后就OK了。

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: