首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IDE 2.4 :在ElasticSearch中运行良好,但不如JAR

IDE 2.4 :在ElasticSearch中运行良好,但不如JAR
EN

Stack Overflow用户
提问于 2016-10-17 17:03:25
回答 1查看 133关注 0票数 0

在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

请让我知道可能的原因或解决方案。

EN

回答 1

Stack Overflow用户

发布于 2016-10-18 06:43:44

经过几个小时的调试,终于找到了解决方案。在提到这些之前,先给出一些快捷键。

  1. 如果els服务器是2.4.1,maven jar也应该是2.4.1
  2. Add log4j dependencies for more log in详细信息(可从这里找到)。
  3. 在插件中添加阴影与集成开发环境(可能最初运行,但要运行prod,必须遵循上面的说明)。

,但为什么它在集成开发环境中运行还没有答案?

Java Maven依赖项

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40082295

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档