Instantiate TransportClient in ES 7.8 help

I would like to replace the way I instantiate TransportClient in 7.8 since our application is heavily dependent on TransportClient at the moment. TransportClient will be migrated to RestHighLevelClient.

Settings settings = Settings.builder().loadFromPath(Paths.get("config/elasticsearch.yml").toAbsolutePath()).build();
TransportClient client = new PreBuiltTransportClient(settings)
                    .addTransportAddress(new TransportAddress(InetAddress.getByName("127.0.0.1"), 9300));

This is no longer valid in 7.8 since the run time error occurs:

java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.debug(Ljava/lang/String;Ljava/lang/Object;)V

	at org.elasticsearch.threadpool.ThreadPool.<init>(ThreadPool.java:212)
	at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:153)
	at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:298)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:130)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:116)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:106)

It looks good to me.

What happens if you write instead:

Settings settings = Settings.EMPTY;
TransportClient client = new PreBuiltTransportClient(settings)
    .addTransportAddress(new TransportAddress(InetAddress.getByName("127.0.0.1"), 9300));

Just to make sure where the problem is coming from...

But yeah, you should really move to the Rest Client. :slight_smile:

It produces exactly the same error. Any ideas would be welcomed.

What is the full output of:

mvn dependency:tree
[WARNING] Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
Downloading from osgeo-release: https://repo.osgeo.org/repository/release/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloading from my-local-repo: file:///home/pete/src/apis2/lib/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloading from central: https://repo1.maven.org/maven2/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloading from mvnrepository.com: https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloading from maven2-repository.dev.java.net: http://download.java.net/maven/2/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloading from osgeo: http://download.osgeo.org/webdav/geotools/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
Downloaded from central: https://repo1.maven.org/maven2/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml (1.1 kB at 2.4 kB/s)
Downloading from osgeo-snapshot: https://repo.osgeo.org/repository/snapshot/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml
[WARNING] Could not transfer metadata org.eclipse.emf:org.eclipse.emf.ecore/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
Downloading from central: https://repo1.maven.org/maven2/io/grpc/grpc-core/maven-metadata.xml
Downloading from osgeo-release: https://repo.osgeo.org/repository/release/io/grpc/grpc-core/maven-metadata.xml
Downloading from my-local-repo: file:///home/pete/src/apis2/lib/io/grpc/grpc-core/maven-metadata.xml
Downloading from mvnrepository.com: https://mvnrepository.com/io/grpc/grpc-core/maven-metadata.xml
Downloading from maven2-repository.dev.java.net: http://download.java.net/maven/2/io/grpc/grpc-core/maven-metadata.xml
Downloading from osgeo: http://download.osgeo.org/webdav/geotools/io/grpc/grpc-core/maven-metadata.xml
Downloaded from central: https://repo1.maven.org/maven2/io/grpc/grpc-core/maven-metadata.xml (2.7 kB at 5.8 kB/s)
[WARNING] Could not transfer metadata io.grpc:grpc-core/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/io/grpc/grpc-core/maven-metadata.xml 403 Forbidden
Downloading from osgeo-release: https://repo.osgeo.org/repository/release/io/netty/netty-codec-http2/maven-metadata.xml
Downloading from my-local-repo: file:///home/pete/src/apis2/lib/io/netty/netty-codec-http2/maven-metadata.xml
Downloading from central: https://repo1.maven.org/maven2/io/netty/netty-codec-http2/maven-metadata.xml
Downloading from mvnrepository.com: https://mvnrepository.com/io/netty/netty-codec-http2/maven-metadata.xml
Downloading from maven2-repository.dev.java.net: http://download.java.net/maven/2/io/netty/netty-codec-http2/maven-metadata.xml
Downloading from osgeo: http://download.osgeo.org/webdav/geotools/io/netty/netty-codec-http2/maven-metadata.xml
Downloaded from central: https://repo1.maven.org/maven2/io/netty/netty-codec-http2/maven-metadata.xml (2.8 kB at 6.0 kB/s)
[WARNING] Could not transfer metadata io.netty:netty-codec-http2/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/io/netty/netty-codec-http2/maven-metadata.xml 403 Forbidden
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ services ---
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.ecore/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.ecore/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.ecore/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata org.eclipse.emf:org.eclipse.emf.common/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/org/eclipse/emf/org.eclipse.emf.common/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer io.grpc:grpc-core/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata io.grpc:grpc-core/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/io/grpc/grpc-core/maven-metadata.xml 403 Forbidden
[WARNING] Failure to transfer io.netty:netty-codec-http2/maven-metadata.xml from https://mvnrepository.com/ was cached in the local repository, resolution will not be reattempted until the update interval of mvnrepository.com has elapsed or updates are forced. Original error: Could not transfer metadata io.netty:netty-codec-http2/maven-metadata.xml from/to mvnrepository.com (https://mvnrepository.com/): Authorization failed for https://mvnrepository.com/io/netty/netty-codec-http2/maven-metadata.xml 403 Forbidden

Just a lot of INFO lines and BUILD SUCCESS at the end aside from these WARNINGs.

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.

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