在Intelli Java IDE中运行时,ElasticSearch 2.4客户端运行良好。当通过jar文件运行相同的代码时,java -jar <jar-path>会给出以下错误。
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{<remote-ip>}{<remote-ip>:9300}]] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207) at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359) at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1226) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56) at com.creo.datawarehouse.es.op.imp.IndexOperationImp.createIndex(IndexOperationImp.java:66) at com.creo.datawarehouse.es.ElasticSearch.initialise(ElasticSearch.java:27) at com.creo.datawarehouse.script.App.main(App.java:37)
POM依赖关系:
<dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>2.4.0</version> </dependency>
This question没有任何应答和what is the jar version for 2.4.0 ES version in this question。
请让我知道可能的原因或解决方案。
发布于 2016-10-18 06:43:44
经过几个小时的调试,终于找到了解决方案。在提到这些之前,先给出一些快捷键。
,但为什么它在集成开发环境中运行还没有答案?
Java Maven依赖项
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<build>
<plugins>
[---]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<configuration>
<finalName>injector-2.4.1</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.elasticsearch.demo.workshop.injector.runner.Generate</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.your.classss.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
[--]
</plugins>
</build>https://stackoverflow.com/questions/40082295
复制相似问题