org.elasticsearch.xpack.XPackClient does not exist in the downloaded jar file

hi
I downloaded the xpack transport jar file v 5.3 from https://www.elastic.co/guide/en/x-pack/current/java-clients.html
After that i tested with example-

      import java.net.InetAddress;

     import org.elasticsearch.client.transport.TransportClient;
  import org.elasticsearch.common.settings.Settings;
  import org.elasticsearch.common.transport.InetSocketTransportAddress;
 import org.elasticsearch.xpack.XPackClient;
 import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;

   public class TestXpaac {

public static void main(String[] args){
Settings settings = Settings.builder().put("xpack.security.user", "elastic:password").build();


try{
	TransportClient client = new PreBuiltXPackTransportClient(settings)
		    .addTransportAddress(new 
InetSocketTransportAddress(InetAddress.getByName("localhost"), 9200));
   //		ActionFuture<ClusterHealthResponse> healthFuture = 
 client.admin().cluster().health(Requests.clusterHealthRequest());

    System.out.println("kl="+client.settings().getAsMap());
		XPackClient xpackClient = new XPackClient(client);

 }
catch (Exception e) {
        e.printStackTrace();
        }

    }
   }

but even after including the jar in build path i get compiler exception while importing org.elasticsearch.xpack.XPackClient
I am able to do the same if i use a maven project.
In that it specifies the org.elasticsearch.plugin x-pack-api- 5.3.0 version.
This version is not present in the maven website.The latest is 5.0.0.
Is something wrong with the jar in the website?

Please help.

Thanks

Probably you did not add the maven repository in your pom.xml.

Run mvn install from the CLI and look at the warn/error messages

The code works with maven. I am trying to build it with jar files (no maven).
Thats when i get the errors.

So you have to import manually all dependencies (all jars)

i couldn't find the jar for org.elasticsearch.plugin x-pack-api- 5.3.0

If you used maven in a previous run then it's probably in your ~/.m2 dir.

cool. Thanks @dadoonet

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