Unable to load x-pack plugin in java application

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

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

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.

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

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