Error - XPack Class not found Exception in java

(Azhar) #1

I got this error please help.

Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/xpack/XPackPlugin
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(
at com.ef.elastics.elastic.main(
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.xpack.XPackPlugin
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
... 3 more

(David Pilato) #2

What are you doing and how?
Did you follow the guide?
Any step you missed?

(Azhar) #3

yes i do follow the steps as explained in the documentation:
when i try to download the maven repo it says artifact missing id, so i download x-pack transport manually and insert it in my java project but now i have this problem says class not found exception. I trying to do indexing using java api client since i install x-pack it needs authentication.

(David Pilato) #4

You have to fix the maven problem first. You are missing dependencies here.
Did you add the repository?

If it's not working may be you are using Nexus in your company and it is misconfigured?

(Azhar) #5

I have fixed my repository problem now i have different error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at org.elasticsearch.plugins.PluginsService.loadPlugin(
at org.elasticsearch.plugins.PluginsService.(
at org.elasticsearch.client.transport.TransportClient.newPluginService(
at org.elasticsearch.client.transport.TransportClient.buildTemplate(
at org.elasticsearch.client.transport.TransportClient.(
at org.elasticsearch.transport.client.PreBuiltTransportClient.(
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(
at com.ef.elastics.elastic.main(
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.unboundid.util.Debug
at org.elasticsearch.xpack.XPackPlugin$
at org.elasticsearch.xpack.XPackPlugin$
at Method)
at org.elasticsearch.xpack.XPackPlugin.(
... 13 more

(Alexander Reelsen) #6


can you make sure, that you are also downloading and using transitive dependencies of the x-pack client. Running mvn dependency:tree will show you those for example. It seems, those are missing.


(Azhar) #7

thank you the solution work for me

(Igor) #8

So what solution is that?
I am following these steps and I am getting:

ava.lang.NoClassDefFoundError: org/elasticsearch/xpack/XPackPlugin
    at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(
    at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(

(Alexander Reelsen) #9

Please open new issues instead of appending to old issues, that have been resolved.

This looks as if the dependency you specified could not be downloaded. Did you specify the additional repository as mentioned at the documentation you linked?

How does your pom.xml/ file look like?


(lukasSirhal) #10

Hello, I have same issue.

My pom.xml look like:


And while i create TransportClient

    TransportClient transportClient = new PreBuiltXPackTransportClient(
    .put("", cluster)
    .put("", String.format("%s:%s", user, passwd))

i have this error:

java.lang.NoClassDefFoundError: org/elasticsearch/xpack/XPackPlugin
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(

thanks for help

(Tim Vernum) #11

org.elasticsearch.xpack.XPackPlugin can be found in x-pack-api-5.1.1.jar

If you follow the instructions on the Java API page linked above, then you should automatically download the API jar.

If you run mvn dependency:tree then you should see output that looks like:

[INFO] +- org.elasticsearch.client:x-pack-transport:jar:5.1.1:compile
[INFO] |  +- org.elasticsearch.plugin:x-pack-api:jar:5.1.1:compile
[INFO] |  |  +- org.elasticsearch.plugin:transport-netty3-client:jar:5.1.1:compile
[INFO] |  |  |  \- io.netty:netty:jar:3.10.6.Final:compile
[INFO] |  |  +- org.elasticsearch.plugin:transport-netty4-client:jar:5.1.1:compile


If you're not seeing that, then either:

  1. You didn't follow the instructions correctly, and you need to try them again - the #1 thing people miss is that you need to add the elasticsearch-releases repository to your pom.xml.
  2. You have an internal repository manager (nexus, artifactory, etc) that hasn't been configured correctly. If that's the case then you need to talk to whoever administers your repository manager, there's not a lot we can do to diagnose the problem.

(lukasSirhal) #12

It seems that this is it, we have own artifactory but when i try use
i have 404 error.

Do you have any public elastic repository?

(David Pilato) #13

@lukasSirhal1 May be you did not declare correctly the elasticsearch repo in artifactory? is where artifacts are stored. IIRC there is a specific option which basically tries to list files in the repo which is not supported. So you have to uncheck that option (don't remember the name).

If you are still having troubles, share in a new thread how you configured artifactory.

(lukasSirhal) #14

Ok i created new topic

(system) #15

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