XPackPlugin Class Not Found

Team,

We are upgrading to ES 5.3.x and as a result, have included all the necessary dependencies as follows:

    compile "org.elasticsearch:elasticsearch:5.3.2" 
compile "org.elasticsearch.client:x-pack-transport:5.3.2"
compile "org.elasticsearch.client:transport:5.3.2"
compile "org.apache.logging.log4j:log4j-api:2.7"
compile "org.apache.logging.log4j:log4j-core:2.7"

We have fixed all the compilation issues. We are using Gradle to build our application. In grade we have this repo entry as well:
maven { url "https://artifacts.elastic.co/maven" }

However, I am trying to start the application it fails with the below exception:

Caused by: java.lang.ClassNotFoundException: org.elasticsearch.xpack.XPackPlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_66]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_66]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:55) ~[x-pack-transport-5.3.2.jar:5.3.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:50) ~[x-pack-transport-5.3.2.jar:5.3.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:46) ~[x-pack-transport-5.3.2.jar:5.3.2]

I have read few posts and it seems there is some issue while downloading the transitive dependencies for x-pack.

Please let me know how to go about this now and I am not even able to find the XPackPlugin jar anywhere so that I can manually upload to our local nexus repo and make it work.

Need help asap.

Thanks much guys !

Arun

When you say you use gradle, do you mean Elasticsearch's build-tools gradle plugin, or just gradle in general? If using build-tools, transitive dependencies are disabled (this is how we prefer to handle all dependencies so that we know exactly which jars we are pulling in). The jar file containing XPackPlugin is org.elasticsearch.plugin:x-pack-api, which is a dependency of x-pack-transport.

Hi Ryan,

Thanks for your reply. I intended to mean Gradle in general. When we clean build our project using Gradle (./gradlew clean build), it downloads all the transient dependencies of x-pack-transport (5.3.2). However, it does not pull the x-pack-api. I am not sure if I'm missing something here or there is a problem somewhere else.

compile "org.elasticsearch.client:x-pack-transport:5.3.2"

I even tried downloading x-pack-plugin in the following manner:

compile "org.elasticsearch.plugin:x-pack-api:5.3.2"

Even the above command doesn't seem to find any x-pack-api jars.

Please let me know what other ways I can try or where I can download the x-pack-api jar directly.

Appreciate your help in this.

I created a very simple build file which compiles fine for me. Can you compare to what you have?

My build.gradle:

apply plugin: 'java'

repositories {
  mavenCentral()
  maven {
    url 'https://artifacts.elastic.co/maven'
  }
}

dependencies {
  compile 'org.elasticsearch.client:x-pack-transport:5.3.2'
}

And my compile output, showing x-pack-api is downloading:

:compileJava
Download https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/5.3.2/x-pack-transport-5.3.2.jar
Download https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack-api/5.3.2/x-pack-api-5.3.2-jar
Download https://repo1.maven.org/maven2/org/elasticsearch/client/transport/5.3.2/transport-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/plugin/transport-netty3-client/5.3.2/transport-netty3-client-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/plugin/transport-netty4-client/5.3.2/transport-netty4-client-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/client/rest/5.3.2/rest-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/client/sniffer/5.3.2/sniffer-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/5.3.2/elasticsearch-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/plugin/reindex-client/5.3.2/reindex-client-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/plugin/lang-mustache-client/5.3.2/lang-mustache-client-5.3.2.jar
Download https://repo1.maven.org/maven2/org/elasticsearch/plugin/percolator-client/5.3.2/percolator-client-5.3.2.jar
:processResources NO-SOURCE
:classes
:jar
:assemble

BUILD SUCCESSFUL

Great! My config also look the same. Let me double check and try to see what's going wrong.

For me it just downloads these:

ownload http://nexus-us.in.fixstream.com:8081/nexus/content/groups/public/org/elasticsearch/client/x-pack-transport/5.3.2/x-pack-transport-5.3.2.pom
Download http://nexus-us.in.fixstream.com:8081/nexus/content/groups/public/org/elasticsearch/client/x-pack-transport/5.3.2/x-pack-transport-5.3.2.jar

POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>x-pack-transport</artifactId>
  <version>5.3.2</version>
  <description>POM was created by Sonatype Nexus</description>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>x-pack-transport</artifactId>
  <version>5.3.2</version>
  <description>POM was created by Sonatype Nexus</description>
</project>

I think you did not add the following repo to your company nexus:

   <repositories>
      <!-- add the elasticsearch repo -->
      <repository>
         <id>elasticsearch-releases</id>
         <url>https://artifacts.elastic.co/maven</url>
         <releases>
            <enabled>true</enabled>
         </releases>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </repository>
   </repositories>

See https://www.elastic.co/guide/en/x-pack/current/java-clients.html

I am not sure about the pom.xml of nexus but I tried adding the above repo directly from Nexus UI. Even though it says in service but it is not able to pull any data from the https:// url.

Attached is the snapshot below.

I think you need to clean existing files in your nexus repo under /nexus/content/groups/public/org/elasticsearch/client/x-pack-transport/5.3.2/.

Here is how I added it for a test a while ago. It was a proxy.

Note that this elastic repo does not contain any index so you should better set "download remote indexes" to false.

Thanks David !!

Unfortunately, something is messed up at my end. I have tried everything possible now :slight_smile: So I manually downloaded all the jars somehow and uploaded them to my local nexus. We are good for now !

Appreciate yours and Ryan's quick help on this.

elasticsearch repo doesn't work with nexus2.
It works with nexus3 only.

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