# Exception in thread "main" elasticsearchexception\[failed to initialize a trustmanagerfactory\]; nested: nosuchfileexception\[/etc/elasticsearch/certs/elastic-certificates.p12\]

**URL:** <https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514>\
**Category:** Elasticsearch\
**Created:** [February 5, 2018, 7:05pm UTC](https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514 "2018-02-05T19:05:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.d.garland100](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@t.d.garland100](https://discuss.elastic.co/u/t.d.garland100)\
**Post date:** [February 5, 2018, 7:05pm UTC](https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514/1 "2018-02-05T19:05:10Z")

</div>

I am getting this message when I run the following command in the directory /usr/share/elasticsearch

bin/x-pack/setup-passwords interactive

Copy the applicable .p12 file into a directory within the Elasticsearch configuration directory on each node (the instructions after creating the certificate)

I am not understanding where else I am to copy the newly created certificate to. I tried to copy it to the following directory

/etc/elasticsearch/certs

however this file does not exist

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [February 6, 2018, 4:04am UTC](https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514/2 "2018-02-06T04:04:37Z")

</div>

> [@t.d.garland100](#):
>
> I tried to copy it to the following directory
> 
> /etc/elasticsearch/certs
> 
> however this file does not exist

Then you need to create the directory.  
Elasticsearch just requires that the file is put somewhere within your config directory, and then you refer to that pathname in your `elasticsearch.yml` you can put it in a "certs/" directory, or a "tls/" directory, or directly in the `/etc/elasticsearch` directory if you want to, it's up to you.

---

<div class="post-metadata">

**Author:** ![t.d.garland100](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@t.d.garland100](https://discuss.elastic.co/u/t.d.garland100)\
**Post date:** [February 6, 2018, 2:36pm UTC](https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514/3 "2018-02-06T14:36:03Z")

</div>

Thank you . Actually I did just that.

---

<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:** [March 6, 2018, 2:36pm UTC](https://discuss.elastic.co/t/exception-in-thread-main-elasticsearchexception-failed-to-initialize-a-trustmanagerfactory-nested-nosuchfileexception-etc-elasticsearch-certs-elastic-certificates-p12/118514/4 "2018-03-06T14:36:08Z")

</div>

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