# NoNodeAvailableException, cannot connect SpringBoot 2.0 and Elasticsearch5.5.0

**URL:** <https://discuss.elastic.co/t/nonodeavailableexception-cannot-connect-springboot-2-0-and-elasticsearch5-5-0/127181>\
**Category:** Elasticsearch\
**Created:** [April 7, 2018, 11:25pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-cannot-connect-springboot-2-0-and-elasticsearch5-5-0/127181 "2018-04-07T23:25:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Cuka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/martin_cuka/32/29734_2.png) [@Martin\_Cuka](https://discuss.elastic.co/u/Martin_Cuka)\
**Post date:** [April 7, 2018, 11:25pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-cannot-connect-springboot-2-0-and-elasticsearch5-5-0/127181/1 "2018-04-07T23:25:44Z")

</div>

Hello,

I know it was discussed several times however after reading all threads I am still not able connect SpringBoot 2.0 application to ElasticSearch 5.5.0 while using TransportClient (as Java High-Level REST Client was released in ver 5.6.0 i can't use it).

Here's my application so far:

**pom.xml**  
  
org.springframework.boot  
spring-boot-starter-parent  
2.0.1.BUILD-SNAPSHOT

```
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<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-web</artifactId>
    </dependency>

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

```

**config class**  
@Configuration  
@EnableElasticsearchRepositories(basePackages = "com.example.demo")  
public class EsConfig {

```
    @Value("${elasticsearch.host}")
    private String EsHost;

    @Value("${elasticsearch.port}")
    private int EsPort;

    @Value("${elasticsearch.clustername}")
    private String EsClusterName;

    @Bean
    public Client client() throws Exception {

        Settings esSettings = Settings.builder()
                .put("cluster.name", EsClusterName)
                .build();

        TransportClient client = new PreBuiltTransportClient(esSettings)
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(EsHost), Integer.valueOf(EsPort)));
        return client;
    }

    @Bean
    public ElasticsearchOperations elasticsearchTemplate() throws Exception {
        return new ElasticsearchTemplate(client());
    }
}

```

**application.properties**  
elasticsearch.clustername = elasticsearch  
elasticsearch.host = localhost  
elasticsearch.port = 9300

As i run the application I get an error:

failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{ru3fMzoqTQygBpT5C6KXXw}{localhost}{127.0.0.1:9300}]

My elasticsearch is running in docker container

`run -p 9200:9200 -p 9300:9300 --name elasticsearch -d --network mynetwork elasticsearch:5.5.0`

TransportClient is set to listen on Port 9300  
SpringBoot 2.0 should be compatible with Elastic 5.X  
Does anyone know what could I change in order to make it work ?  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 5, 2018, 11:25pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-cannot-connect-springboot-2-0-and-elasticsearch5-5-0/127181/2 "2018-05-05T23:25:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
