Java Node Client - path.home is not configured


(Shawn Johnson) #1

I am trying to use the Java Node Client and connect to a separate local elasticsearch node, running in a separate JVM. I get the following error when trying to follow the examples provided in the docs (https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/node-client.html).

Code:

Node node = NodeBuilder.nodeBuilder()
        .client(true)
        .local(false)
        .settings(Settings.settingsBuilder().put("cluster.name", ES_CLUSTER_NAME))
        .node();

Error:

Exception in thread "main" java.lang.IllegalStateException: path.home is not configured
at org.elasticsearch.env.Environment.(Environment.java:99)
at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:82)
at org.elasticsearch.node.Node.(Node.java:128)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:152)

I could obviously add a "path.home" to the settings, but I just don't see this documented anywhere - so what should the value be, and why do I need to set it?

thanks!


(Jörg Prante) #2

path.home is documented at https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-dir-layout.html

A client node is a real node, in contrast to a transport client.

You need to pass path.home to a node so it knows where to lookup configuration files or a place to write logs or save cluster state data .


(Shawn Johnson) #3

Thanks for the reply.

For those others that might be hitting this error... I'm running a simple Java program from eclipse. In the launch profile I added:

-Des.path.home=/myproject/path

Since I save the launch file to be shared by the other developers on the team, I use an eclipse variable as the path.

-Des.path.home=${project_loc:/ElasticLoader}

(Prakash) #4

I tried running from eclipse by setting -Des.path.home=/myproject/path in VM arguments in Run configuration, but i am still facing the issue


(system) #5