X-Pack Transport JAR dependency down load issue

Hello Elastic Team,

To enable the security in the elastic, I downloaded the x-pack plugin. Since then the following code is NOT returning the connection.
client = new PreBuiltTransportClient(settings).addTransportAddress(
new InetSocketTransportAddress(inetAddress, port));

Updated the code to
client = new PreBuiltXPackTransportClient(
Settings.builder().put("cluster.name", "elasticsearch").build()).addTransportAddress(
new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));

Facing run time issue with the latest code
Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/xpack/XPackPlugin
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 com.symitar.padapter.ESHelper.getClient(ESHelper.java:142)
at com.symitar.padapter.ESHelper.main(ESHelper.java:67)
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.xpack.XPackPlugin
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more

Tried to down load the dependency as per the link "https://www.elastic.co/guide/en/x-pack/current/api-java.html"

[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.elasticsearch.client:x-pack-transport:jar:5.4.3: Failed to read artifact descriptor for org.elasticsearch.client:x-pack-transport:jar:5.4.3: Could not transfer artifact org.elasticsearch.client:x-pack-transport:pom:5.4.3 from/to elasticsearch-releases (https://artifacts.elastic.co/maven): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.elasticsearch.client:x-pack-transport:jar:5.4.3
** at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)**
** at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)**

Downloading the jar "x-pack-transport-5.4.3.jar" and placing it in the class path has not helped.

This looks like it is the same problem you had here.

It looks like you are behind a proxy that is making a mess of your SSL certificates.

Can you check what certificate your web browser is using for our download site?
If you are using Google Chrome with Dev Tools enabled, the steps to do that are:

(1) Open https://artifacts.elastic.co/maven in Chrome
(2) Right click on the page and select Inspect
(3) In the Dev Tools window, click the Security tab
(4) Click the View certificate button
(5) The certificate should say:

Issued by: DigiCert SHA2 Secure Server CA

(6) Expand the > Details section in that same popup, and then scroll to the very bottom
(7) The fingerprints for the certificate should be:

SHA-256: 8 2E 31 1B D2 9C DF E4 18 78 C6 17 D5 CA E7 
SHA-1: FB C0 C2 71 9F 00 59 21 71 DF 50 DB A1 DF FD B8 56 21 D1 8F

If those details don't match what you see in your browser, then something in your corporate environment is causing your download problem and you'll need to discuss it with your internal network administrators.

Thanks a lot for the reply.

I followed the steps mentioned by you. Neither the issued by nor the foot prints are matching. We are in touch with our network team. It might take a day or 2 for approval or might not get an approval. Not sure as of now.

Do we know why the JAR downloaded using the following site is not working

Why it is throwing the following exception
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.xpack.XPackPlugin

Will the maven dependency will download more than 1 jar to resolve the issue ?

Hello Elastic Team

Thanks for the help.

Certificate issue is solved by my network team. I have downloaded the dependency JAR for x-pack

  <!--add the elasticsearch repo-->

  <!--add the x-pack jar as a dependency-->
  <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->

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