java.lang.IllegalStateException: Received message from unsupported version: [2.0 .0] minimal compatible version is: [5.0.0]
Asked Answered
T

4

5

I'm trying to do this sample tutorial, in order to get familiar with elasticsearch. but running the project it gives this error in intellij:

org.elasticsearch.transport.NodeDisconnectedException: [][127.0.0.1:9300][cluster:monitor/nodes/liveness] disconnected

2017-08-22 13:32:10.489 ERROR 6372 --- [           main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]
2017-08-22 13:32:10.669  INFO 6372 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
--ElasticSearch-->
client.type = transport
cluster.name = mkyong-cluster
name = Mahkizmo
network.server = false
node.client = true
transport.ping_schedule = 5s
<--ElasticSearch--
2017-08-22 13:32:10.751  INFO 6372 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-08-22 13:32:10.755 ERROR 6372 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
    at com.mkyong.Application.main(Application.java:26) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_92]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_92]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92]
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{127.0.0.1:9300}]
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:326) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:223) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:295) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86) ~[elasticsearch-2.4.4.jar:2.4.4]
    at org.elasticsearch.act

and in the elasticsearch.bat it gives this error:

java.lang.IllegalStateException: Received message from unsupported version: [2.0
.0] minimal compatible version is: [5.0.0]
        at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport
.java:1379) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channe
lRead(Netty4MessageChannelHandler.java:74) ~[transport-netty4-5.5.2.jar:5.5.2]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
ractChannelHandlerContext.java:362) [netty-transport-4.1.11.Final.jar:4.1.11.Fin
al]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
ractChannelHandlerContext.java:348) [netty-transport-4.1.11.Final.jar:4.1.11.Fin
al]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
ctChannelHandlerContext.java:340) [netty-transport-4.1.11.Final.jar:4.1.11.Final
]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMes
sageDecoder.java:310) [netty-codec-4.1.11.Final.jar:4.1.11.Final]

I searched and it's said that it's maybe conflict between spring boot and elasticsearch version. but in the pom file of that tutorial version of elastic search isn't specified:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
    </parent>



    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Runtime, for Embedded Elasticsearch,
            comment this if connect to external elastic search server-->
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.data</groupId>-->
            <!--<artifactId>spring-data-commons</artifactId>-->
            <!--<version>1.13.3.RELEASE</version>-->
        <!--</dependency>-->

    </dependencies>

is the problem of confliction of versions and how can I solve it?

Traipse answered 22/8, 2017 at 9:29 Comment(5)
Apparently you're running ES 2.x, is that right?Islamite
@Islamite i thought so also but you see this log "at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport .java:1379) ~[elasticsearch-5.5.2.jar:5.5.2]" here says 5.5.2. message and log trace are not the sameNorthington
No I run ES 5.5.2 @IslamiteTraipse
5.5.2 is the JARs you're loading, not the ES you're running. What do you get when running curl -XGET localhost:9200 ?Islamite
name "87VwbOg" cluster_name "mkyong-cluster" cluster_uuid "u54dczmGQ0Ge6F5FO5HcDw" version number "5.5.2" build_hash "b2f0c09" build_date "2017-08-14T12:33:14.154Z" build_snapshot false lucene_version "6.6.0" tagline "You Know, for Search" @IslamiteTraipse
A
3

Take a look at my Github repository. It works with an instance of Elasticsearch version 2.4.6.

Unfortunately, Spring Boot Starter Data Elasticsearch does not support Elasticsearch version 5.x yet, they are working on it, but you can use my repository just changing the model propertly and update the repository with your own methods.

Your error is because you are using an instance of Elasticsearch 5.x and you need a 2.x version.

Adz answered 4/11, 2017 at 23:41 Comment(4)
I am getting this exception using elasticsearch-2.4.0Gardie
Here is what I get from localhost:9200 "version" : { "number" : "2.4.0", "build_hash" : "ce9f0c7394dee074091dd1bc4e9469251181fc55", "build_timestamp" : "2016-08-29T09:14:17Z", "build_snapshot" : false, "lucene_version" : "5.5.2" }Gardie
Thank you so much Carlos Vázquez Losada. I tried to run elasticsearch with spring data by using many other demos and tutorials whole day and then I found your answer here. Its worked in single try without any error.Lazo
You are wellcome @vishalrana!! I enjoy that my solution worked for you!! Have a nice day!!Density
I
2

Spring doesn't support latest versions of elasticsearch client. You can refer to the following github repo for version compatibility

Illassorted answered 26/8, 2019 at 20:57 Comment(0)
F
1

I know it late but today I faced the same issue and solved it. I used the same thing what you are using. I tried all the way but nothing worked. Actually When you download the spring proj from spring.initializer It downloads the latest version of elastic internally. If you hover on spring-boot-starter-data-elasticsearch you can see the which version of elastic it will fetch from repository.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>

So to resolve this issue you I change the version of Spring:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>**1.5.2.RELEASE**</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

Then right click on your project and do maven update. It should resolve your issue.

Famed answered 16/7, 2018 at 16:27 Comment(0)
F
1

You should use this dependency

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-connector-elasticsearch5_2.12</artifactId>
    <version>1.7.2</version>
</dependency>
Forge answered 15/3, 2019 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.