# Failed to load elasticsearch nodes after installing Shield

**URL:** https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [January 12, 2017, 5:28am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316 "2017-01-12T05:28:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![rita](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rita](https://discuss.elastic.co/u/rita)
#### Post date: [January 12, 2017, 5:28am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/1 "2017-01-12T05:28:39Z")

</div>

Hi,  
We have a Java application that connects to elasticSearch 2.4 (standalone) via Spring Data and Spring Boot (1.4.0). The connection settings are:  
spring.data.elasticsearch.cluster-name=  
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300

Everything worked fine before installing Shield.  
I installed Shield on my DEV (windows) box, The GET \_shield shows status as enabled. Added more settings as below,  
spring.data.elasticsearch.properties.shield.user=:  
spring.data.elasticsearch.clientPingTimeout=30s  
spring.data.elasticsearch.clientNodesSamplerInterval=30s  
spring.data.elasticsearch.properties.request.headers.X-Found-Cluster=s  
spring.data.elasticsearch.properties.shield.transport.ssl=false  
however, the application failed to start due to error:  
`SEVERE: 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}]`

Does anyone have any suggestions?  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 16, 2017, 12:30am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/2 "2017-01-16T00:30:27Z")

</div>

Can you curl localhost:9200 to make sure ES is up?  
Have you defined any users in Shield?

[https://www.elastic.co/guide/en/shield/current/\_using\_elasticsearch\_java\_clients\_with\_shield.html](https://www.elastic.co/guide/en/shield/current/_using_elasticsearch_java_clients_with_shield.html) may also be of use.

---

<div class="post-metadata">

### Author: ![rita](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rita](https://discuss.elastic.co/u/rita)
#### Post date: [January 16, 2017, 12:52am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/3 "2017-01-16T00:52:40Z")

</div>

Hi Mark,

I use Sense plugin, yes, ES is up,

GET \_shield:  
"status": "enabled",

GET \_shield/authenticate:  
{  
"username": "\*\*\*",  
"roles": [  
"admin"  
],  
"full\_name": null,  
"email": null,  
"metadata": {}  
}

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 16, 2017, 12:54am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/4 "2017-01-16T00:54:46Z")

</div>

If you have defined a user in Shield, it doesn't look like you have used that user in your code;

> [@rita](#):
>
> spring.data.elasticsearch.properties.shield.user=:

---

<div class="post-metadata">

### Author: ![rita](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rita](https://discuss.elastic.co/u/rita)
#### Post date: [January 16, 2017, 3:20am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/5 "2017-01-16T03:20:25Z")

</div>

It seems like it is Spring data setting issue, the following key-value pair is not recognised and passed to ES:

spring.data.elasticsearch.properties.shield.user= es\_admin:\*\*\*

The following Java client works:

```
Settings settings = Settings.settingsBuilder()
        .put("cluster.name", clusterName)
        .put("shield.user", "es_admin:***").build();

TransportClient client = TransportClient.builder()
        .addPlugin(ShieldPlugin.class)
        .settings(settings)
        .build()
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

```

This [No Node Available with Spring Data and Shield](https://discuss.elastic.co/t/no-node-available-with-spring-data-and-shield/52003) elastic cloud topic mentioned Spring data settings, but we use standalone ES.

---

<div class="post-metadata">

### Author: ![rita](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rita](https://discuss.elastic.co/u/rita)
#### Post date: [January 16, 2017, 7:01am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/6 "2017-01-16T07:01:03Z")

</div>

Error message:  
Jan 16, 2017 5:53:35 PM org.springframework.data.elasticsearch.client.TransportClientFactoryBean buildClient  
INFO: adding transport node : localhost:9300  
Jan 16, 2017 5:56:52 PM org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository   
SEVERE: 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}]

I debugged into TransportClientFactoryBean buildClient(), the value for "shield.user" was passed in.  
I suspect because the buildClient method does not have `.addPlugin(ShieldPlugin.class)`, hence the shield user credentials were NOT passed to ES.

org.springframework.data.elasticsearch.client.TransportClientFactoryBean spring-data-elasticsearch:2.0.2.RELEASE

---

<div class="post-metadata">

### Author: ![rita](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rita](https://discuss.elastic.co/u/rita)
#### Post date: [January 18, 2017, 5:23am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/7 "2017-01-18T05:23:02Z")

</div>

Overriding default TransportClientFactoryBean made it work.

There is a Spring Data Elasticsearch Jira ticket for this [Add plugins management on TransportClientFactoryBean](https://jira.spring.io/browse/DATAES-310)

---

<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: [February 15, 2017, 5:23am UTC](https://discuss.elastic.co/t/failed-to-load-elasticsearch-nodes-after-installing-shield/71316/8 "2017-02-15T05:23:07Z")

</div>

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