# Using graphs in java : cient creation error

**URL:** <https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422>\
**Category:** Elasticsearch\
**Created:** [October 26, 2017, 12:12pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422 "2017-10-26T12:12:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [October 26, 2017, 12:12pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/1 "2017-10-26T12:12:11Z")

</div>

Hello,

I'm currently testing the graph api offered by X-pack.  
I could toy a bit with it using kibana, and wanted to test using it in my java application

However, I'm stuck at the creation of the PreBuiltXPackTransportClient.

Here's the creation code :

> ```
> Settings settings = Settings.builder()
> .put("cluster.name", "mycluster").build();
> 
> TransportClient client = new PreBuiltXPackTransportClient(settings);
> try {
> client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("myhost"), 9301));
> } catch (UnknownHostException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> 
> ```

I'm getting this chain of errors

> Exception in thread "main" ElasticsearchException[Failed to load plugin class [org.elasticsearch.xpack.XPackPlugin]]; nested: InvocationTargetException; nested: ElasticsearchException[failed to initialize a TrustManagerFactory]; nested: IOException[Keystore was tampered with, or password was incorrect]; nested: UnrecoverableKeyException[Password verification failed];  
> at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:434)  
> at org.elasticsearch.plugins.PluginsService.(PluginsService.java:103)  
> at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:101)  
> at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:126)  
> at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:265)  
> at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:130)  
> at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:55)  
> at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:50)  
> at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:46)  
> at application.TestGraph.main(TestGraph.java:22)  
> Caused by: java.lang.reflect.InvocationTargetException  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
> at java.lang.reflect.Constructor.newInstance(Constructor.java:422)  
> at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:423)  
> ... 9 more  
> Caused by: ElasticsearchException[failed to initialize a TrustManagerFactory]; nested: IOException[Keystore was tampered with, or password was incorrect]; nested: UnrecoverableKeyException[Password verification failed];  
> at org.elasticsearch.xpack.ssl.StoreTrustConfig.createTrustManager(StoreTrustConfig.java:57)  
> at org.elasticsearch.xpack.ssl.SSLService.createSslContext(SSLService.java:378)  
> at org.elasticsearch.xpack.ssl.SSLService.loadSSLConfigurations(SSLService.java:401)  
> at org.elasticsearch.xpack.ssl.SSLService.(SSLService.java:79)  
> at org.elasticsearch.xpack.XPackPlugin.(XPackPlugin.java:205)  
> ... 14 more  
> Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect  
> at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)  
> at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)  
> at java.security.KeyStore.load(KeyStore.java:1445)  
> at org.elasticsearch.xpack.ssl.CertUtils.trustManager(CertUtils.java:168)  
> at org.elasticsearch.xpack.ssl.StoreTrustConfig.createTrustManager(StoreTrustConfig.java:55)  
> ... 18 more  
> Caused by: java.security.UnrecoverableKeyException: Password verification failed  
> at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770)  
> ... 22 more

However, I disabled x-pack security on my cluster.  
I do not understant why the client creation fails at a password verification if I do not have any security.

The version I'm using is 5.5.1.

Can anyone help me with any info on what I might be doing wrong?  
Thanks.

---

<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:** [October 26, 2017, 12:45pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/2 "2017-10-26T12:45:45Z")

</div>

That error is referring to the password for your truststore.  
Is your application running with a system wide truststore defined? E.g. are you setting the `javax.net.ssl.trustStore` system property?

---

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [October 26, 2017, 1:03pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/3 "2017-10-26T13:03:59Z")

</div>

Hello, and thanks for answering.

Yes, that property is set.

It's set as a VM argument.  
And I tried to set it via System.setproperty as well, but still to no avail.

---

<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:** [October 26, 2017, 9:26pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/4 "2017-10-26T21:26:31Z")

</div>

Well then you need to unset it, or also set the password for the truststore as a system property.

If you run X-Pack with a system truststore then it needs the password too.

---

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [November 2, 2017, 1:18pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/5 "2017-11-02T13:18:35Z")

</div>

Thanks for the answer, and sorry for the delay.

Yes, I get it, and that solves my problem.  
Thanks a lot.

---

<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:** [November 30, 2017, 1:18pm UTC](https://discuss.elastic.co/t/using-graphs-in-java-cient-creation-error/105422/6 "2017-11-30T13:18:38Z")

</div>

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