Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 224
ShakibaZar Avatar asked Aug 22 '17 09:08

ShakibaZar


2 Answers

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.

like image 69
Carlos Vázquez Losada Avatar answered Sep 21 '22 16:09

Carlos Vázquez Losada


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

like image 35
rakesh Avatar answered Sep 21 '22 16:09

rakesh