Examples do not work. NoNodeAvailable but curl works

Just trying to play around with ES Java client.

I've cloned https://github.com/elastic/examples/blob/master/Search/recipe_search_java/src/main/java/com/elastic/recipe/IndexRecipesApp.java#L43 and am running the docker image described in https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-cluster-composefile

(https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-cluster-composefile + docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.6.1
)

When running the example I get an error stating

 Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x1092354c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1092b54e0). One of the two will be used. Which one is undefined.

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{0J_3bgt7TvCAfDvAfehIqg}{127.0.0.1}{127.0.0.1:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:60)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:371)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:405)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:394)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:46)
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:53)
at com.elastic.recipe.IndexRecipesApp.main(IndexRecipesApp.java:53)

However when I do an insertion via curl everything works.

Can anyone advise what sillyness I'm doing. Google hasn't been particularly helpful.

I've tried turning sniffing on and off, and changing ports amongst other unsuccessful paths.

Don't use the TransportClient but the rest client.

See https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html

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