Elastic search 6.5.4 Caused by:ClassNotFoundException: org.elasticsearch.xpack.core.XPackClientPlugin

I am getting ClassNotFoundException: org.elasticsearch.xpack.core.XPackClientPlugin with elastic search 6.5.4 version.

pls find the logs which i am getting .
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transportClient' defined in class path resource [com/crmanalytics/main/CRMRestConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'transportClient' threw exception; nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/xpack/core/XPackClientPlugin
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:625) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:455) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1239) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1166) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 50 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'transportClient' threw exception; nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/xpack/core/XPackClientPlugin
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 63 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/xpack/core/XPackClientPlugin
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:47) ~[x-pack-transport-6.5.4.jar:6.5.4]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:42) ~[x-pack-transport-6.5.4.jar:6.5.4]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:38) ~[x-pack-transport-6.5.4.jar:6.5.4]
at com.crmanalytics.main.CRMRestConfig.transportClient(CRMRestConfig.java:68) ~[classes/:na]
at com.crmanalytics.main.CRMRestConfig$$EnhancerBySpringCGLIB$$2e82726f.CGLIB$transportClient$8() ~[classes/:na]
at com.crmanalytics.main.CRMRestConfig$$EnhancerBySpringCGLIB$$2e82726f$$FastClassBySpringCGLIB$$2b5b9379.invoke() ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at com.crmanalytics.main.CRMRestConfig$$EnhancerBySpringCGLIB$$2e82726f.transportClient() ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 64 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.xpack.core.XPackClientPlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_221]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_221]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_221]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_221]
... 78 common frames omitted

i have added the below dependencies , and in java while creating instance getting this class not found exception.
    <dependency>
        		<groupId>org.elasticsearch.client</groupId>
        		<artifactId>x-pack-transport</artifactId>
       			<version>6.5.4</version>
    		</dependency> 		
    		<dependency>
                <groupId>com.unboundid</groupId>
                <artifactId>unboundid-ldapsdk</artifactId>
                </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.58</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>1.58</version>
            </dependency> 

in Java:
client = new PreBuiltXPackTransportClient(settings);

not able to create Transportclient. Pls help me to fix it

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

I am working on the Springboot 2.1.0 version. I have formatted the above post.and here the version of unboundid-ldapsdk is 3.2.0.

Please help me to fix.

Could you update the first post as well?

Don't format all but just the code and logs please.

Yes updated David

It's not.

with 6.3.2 version Its working, but 6.5.4 version is not working .

What is the output of:

mvn dependency:tree

I have downloaded these jars of 6.5.4 version x-pack-transport , x-pack-core .
I tried executing Its working in my local.But while downloading from our maven repository Jars are not downloading.Getting the Unauthorized Error.
can you please clarify me for 6.5.4 version are we required the License ? how we can resolve.

Failed to collect dependencies at org.elasticsearch.client:x-pack-transport:jar:6.5.4 -> 
	org.elasticsearch.plugin:x-pack-core:jar:6.5.4: Failed to read artifact descriptor for 
	org.elasticsearch.plugin:x-pack-core:jar:6.5.4: Could not transfer artifact org.elasticsearch.plugin:
	x-pack-core:pom:6.5.4
Access denied ,  Error code 401, Unauthorized -> [Help 1]

Can you answer my previous question?

I manually downloaded the jars and added the dependency in pom.xml.
Both jars doesn't have any transitive dependency . while running
mvn dependency:tree for both jars ,I am getting the below .

x-pack-transport :6.5.4 [system]
core :6.5.4 [system]

Could you share the full output of the command please?
And may be share the full pom.xml?

Could you run in the command line:

mvn dependency:tree

And share the full output here please?

while running I am getting the "mvn is not recognized as an internal or external command,operable program or batch file." not able to install maven.

Pretty sure you can run it from your IDE.

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