About the JavaAPI - why do not recognize PreBuiltTransportClient

ES 5.1.1, use JavaAPI

As describe at manual, write pom.xml

but have a problem. that don't recognize PreBuiltTransportClient

May be your workspace is not refreshed?

Check in the list of the jars that has been imported if you can see the transport jar.

yes. refresh~ i checked the jar file.
but when i click the PreBuilTransportClient method, it did not point jar file

What gives mvn dependency:tree ?

it my pom.xml file.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  
  <groupId>elasticsearch-test</groupId>
  <artifactId>elasticsearch-test</artifactId>
  <version>1.0.0</version>
    <packaging>jar</packaging>
    
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.3</source>
          <target>1.1</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>

  <dependency>
  	<groupId>org.elasticsearch.client</groupId>
  	<artifactId>transport</artifactId>
  	<version>5.1.1</version>
  </dependency>

  <dependency>
  	<groupId>org.apache.logging.log4j</groupId>
  	<artifactId>log4j-api</artifactId>
  	<version>2.6.2</version>
  </dependency>
  
  <dependency>
  	<groupId>org.apache.logging.log4j</groupId>
  	<artifactId>log4j-core</artifactId>
  	<version>2.6.2</version>
  </dependency>
  
  </dependencies>
</project>

Can you run please:

mvn dependency:tree

BTW this:

          <source>1.3</source>
          <target>1.1</target>

won't work.

You need Java 8 here.

1 Like

thank you very much.

i try update pom.xml

    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.6.0</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>

then operate well
:slight_smile:

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