Error while creating elastic search x-pack transport client

Hi,
I am trying to create Transport client using below code

     .put("cluster.name", clusterName)
      .put("xpack.security.user", "elastic:RIzpjJS0HxVSgzg1oyZy")
      .build()
    val createdClient: TransportClient  = new PreBuiltXPackTransportClient(settings)//.addTransportAddresses(addresses: _*)
      .addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300))

But I am getting error as below

An exception or error caused a run to abort.
java.lang.ExceptionInInitializerError
at org.elasticsearch.xpack.core.XPackClientPlugin.additionalSettings(XPackClientPlugin.java:191)
at org.elasticsearch.plugins.PluginsService.updatedSettings(PluginsService.java:209)
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:136)
at org.elasticsearch.client.transport.TransportClient.(TransportClient.java:280)
at org.elasticsearch.transport.client.PreBuiltTransportClient.(PreBuiltTransportClient.java:128)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:47)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:42)
at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.(PreBuiltXPackTransportClient.java:38)
at com.decooda.es.util.TestHelper$.localClient$lzycompute(TestHelper.scala:34)
at com.decooda.es.util.TestHelper$.localClient(TestHelper.scala:25)
at com.decooda.kibana.KibanaReportTest$$anon$1.(KibanaReportTest.scala:14)
at com.decooda.kibana.KibanaReportTest.(KibanaReportTest.scala:13)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.scalatest.tools.Runner$.genSuiteConfig(Runner.scala:1428)
at org.scalatest.tools.Runner$$anonfun$31.apply(Runner.scala:1236)
at org.scalatest.tools.Runner$$anonfun$31.apply(Runner.scala:1235)
at scala.collection.immutable.List.map(List.scala:284)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1235)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1010)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1506)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.unboundid.util.Debug
at org.elasticsearch.xpack.core.XPackPlugin$1.run(XPackPlugin.java:101)
at org.elasticsearch.xpack.core.XPackPlugin$1.run(XPackPlugin.java:95)
at java.security.AccessController.doPrivileged(Native Method)
at org.elasticsearch.xpack.core.XPackPlugin.(XPackPlugin.java:95)
... 30 more
Caused by: java.lang.ClassNotFoundException: com.unboundid.util.Debug
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
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.core.XPackPlugin$1.run(XPackPlugin.java:99)
... 33 more

I am using sbt to build and test application.
My build.sbt is as below

version := "2.0"

scalaVersion := "2.11.12"


resolvers += "elasticsearch-releases" at "https://artifacts.elastic.co/maven"

libraryDependencies ++= Seq(
  "net.liftweb" %% "lift-json" % "2.6.3",
  "com.typesafe" % "config" % "1.3.1",
  "org.elasticsearch.client" % "x-pack-transport" % "6.3.1",
  "ch.qos.logback" % "logback-classic" % "1.2.3",
  "org.jsoup" % "jsoup" % "1.7.3",
  "org.scalatest" %% "scalatest" % "3.0.5" % "test",
  "org.mockito" % "mockito-core" % "1.9.5" % "test"
)

This is a bug in our POM file for 6.3 - https://github.com/elastic/elasticsearch/issues/31946

You'll need to manually add the 3 dependencies listed in the GitHub issue..

1 Like

Thank you Tim

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