# Unable to load x-pack plugin in java application

**URL:** https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515
**Category:** Elasticsearch
**Created:** [November 29, 2016, 4:06pm UTC](https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515 "2016-11-29T16:06:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mrasante](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@mrasante](https://discuss.elastic.co/u/mrasante)
#### Post date: [November 29, 2016, 4:06pm UTC](https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515/1 "2016-11-29T16:06:04Z")

</div>

I have a java client (a JavaEE app built with maven and deployed on glassfish 4) that is currently unable to load x-pack plugin. Essentially the problem is that I hit an "ElasticsearchException[Failed to load plugin class [org.elasticsearch.xpack.XPack Plugin]]" exception when I instantiate the PreBuiltXPackTransportClient. The rest of the stacktrace indicates failure to initialize TrustManagerFactory but I think this is not the actual problem. The code snippet is as below

```
Settings settings = Settings.builder()
					.put("cluster.name", "######")
					.put("xpack.security.user", "####:#####")
					.build();
	TransportClient client = new PreBuiltXPackTransportClient(settings) // this is where the exception occurs
					.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("#######"), 9300));

```

I added the x-pack dependency in maven with the ff:

```
   <dependency>
         <groupId>org.elasticsearch.client</groupId>
         <artifactId>x-pack-transport</artifactId>
         <version>5.0.0</version>
      </dependency>

```

as instructed on [https://www.elastic.co/guide/en/x-pack/current/java-clients.html](https://www.elastic.co/guide/en/x-pack/current/java-clients.html)

Now I noticed that this artifactId is not available in maven central. Is this dependency still valid for java clients? If so why I am getting this exception? If not, which is the right transport client class to use for comms with secured nodes. Thanks

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [December 5, 2016, 12:09pm UTC](https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515/2 "2016-12-05T12:09:28Z")

</div>

Did you add the elastic maven repositories? That version and artifact are correct. Its going to be hard to help anymore without seeing all of the exceptions including the stacktrace.

---

<div class="post-metadata">

### Author: ![mrasante](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@mrasante](https://discuss.elastic.co/u/mrasante)
#### Post date: [December 9, 2016, 7:08pm UTC](https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515/3 "2016-12-09T19:08:58Z")

</div>

> [@jaymode](#):
>
> anymore without seeing all of the exceptions including the stacktrace.

Hi jaymode,

Thanks for the response; I researched the problem a bit further and found that it's not related to the x-pack plugin or elasticsearch at all. It's all a problem with the glassfish server. I have since fixed it. It mainly is a matter of importing the right cert to the server's keystore

---

<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: [January 6, 2017, 7:09pm UTC](https://discuss.elastic.co/t/unable-to-load-x-pack-plugin-in-java-application/67515/4 "2017-01-06T19:09:16Z")

</div>

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