I wanted to try out X-Pack and when i run my spring application after adding the dependencies, I am getting the following error
Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/operator/OperatorCreationException
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.8.0_172]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[na:1.8.0_172]
at java.lang.Class.getConstructors(Class.java:1651) ~[na:1.8.0_172]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:426) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:105) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:103) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:128) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:262) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:128) ~[transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:58) ~[x-pack-transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:53) ~[x-pack-transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:49) ~[x-pack-transport-6.1.2.jar:6.1.2]
Elasticsearch version - 6.1.2
Transport client version - 6.1.2
X-Pack transport client version - 6.1.2
I tried to format a bit you post as it was looking weird and was really readable. Please for your next post, make sure that it's correctly formatted (use the preview window to check).
Some thoughts:
Why did you manually add bouncycastle lib?
What is your Java version.
But more than this, don't use the transport client but the rest client. The transport client will be removed in the future.
Apologies. I will make sure that I follow the guidelines next time.
Why did you manually add bouncycastle lib?
Initially when I ran my application, I got the below error
Caused by: java.lang.ClassNotFoundException: com.unboundid.util.Debug
at java.net.URLClassLoader$1.run(URLClassLoader.java:370)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.elasticsearch.xpack.XPackPlugin$1.run(XPackPlugin.java:158)
I searched online and implemented the solution given in `this topic . I ran the application after making the above change, now I am getting bouncycastle error
What is your Java version.
1.8
Yes, I plan to move to rest client in next couple of months.
I am getting the same error even after removing unnecessary dependencies. Please note that when i compile, I don't see any errors and application compiles successfully. Getting this error only when i run the application
Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/operator/OperatorCreationException
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.8.0_172]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[na:1.8.0_172]
at java.lang.Class.getConstructors(Class.java:1651) ~[na:1.8.0_172]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:426) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:105) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.newPluginService(TransportClient.java:103) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:128) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:262) ~[elasticsearch-6.1.2.jar:6.1.2]
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:128) ~[transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:58) ~[x-pack-transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:53) ~[x-pack-transport-6.1.2.jar:6.1.2]
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:49) ~[x-pack-transport-6.1.2.jar:6.1.2]
I removed the systempath and scope tags from the pom and tried again. It worked
I thought we need to manually download the jar and specify the path as it isn't available in maven repository. Turns out that the jars are being fetched from es repo.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.