Java.lang.IllegalStateException:jar地狱!在Elastic 6.5.1中

时间:2018-11-29 12:44:47

标签: java xml elasticsearch jar

问题:

  

原因:java.lang.IllegalStateException:罐子地狱!   类:org.elasticsearch.protocol.xpack.migration.UpgradeActionRequired

我试图引用此链接: Elasticsearch JAR hell error

但是问题仍然存在。

错误

         C:\Program Files\elasticsearch-6.5.1\bin>elasticsearch.bat
        [2018-11-29T17:10:36,343][WARN ][o.e.c.l.LogConfigurator  ] [MIT22] Some logging configurations have %marker but don't have %node_name. We will automatically add %node_name to the pattern to ease the migration for users who customize log4j2.properties but will stop this behavior in 7.0. You should manually replace `%node_name` with `[%node_name]%marker ` in these locations:
          C:\ProgramData\Elastic\Elasticsearch\config\log4j2.properties
        [2018-11-29T17:10:36,962][INFO ][o.e.e.NodeEnvironment    ] [MIT22] using [1] data paths, mounts [[(C:)]], net usable_space [408.3gb], net total_space [487gb], types [NTFS]
        [2018-11-29T17:10:36,963][INFO ][o.e.e.NodeEnvironment    ] [MIT22] heap size [1.9gb], compressed ordinary object pointers [true]
        [2018-11-29T17:10:37,341][INFO ][o.e.n.Node               ] [MIT22] node name [MIT22], node ID [xaD9ya8JSTmublSPZEWeOQ]
        [2018-11-29T17:10:37,342][INFO ][o.e.n.Node               ] [MIT22] version[6.5.1], pid[17904], build[default/zip/8c58350/2018-11-16T02:22:42.182257Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
        [2018-11-29T17:10:37,343][INFO ][o.e.n.Node               ] [MIT22] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users\mohd\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -Xmx2048m, -Xms2048m, -Delasticsearch, -Des.path.home=C:\Program Files\elasticsearch-6.5.1, -Des.path.conf=C:\ProgramData\Elastic\Elasticsearch\config, -Des.distribution.flavor=default, -Des.distribution.type=zip]
        [2018-11-29T17:10:37,704][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [MIT22] uncaught exception in thread [main]
        org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin x-pack-core due to jar hell
                at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.5.1.jar:6.5.1]
                at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.5.1.jar:6.5.1]
        Caused by: java.lang.IllegalStateException: failed to load plugin x-pack-core due to jar hell
                at org.elasticsearch.plugins.PluginsService.checkBundleJarHell(PluginsService.java:517) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:462) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:156) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.node.Node.<init>(Node.java:338) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.5.1.jar:6.5.1]
                ... 6 more
        Caused by: java.lang.IllegalStateException: jar hell!
        class: org.elasticsearch.protocol.xpack.migration.UpgradeActionRequired
        jar1: C:\Program Files\elasticsearch-6.5.1\modules\x-pack-core\x-pack-core-6.5.1.jar
        jar2: C:\Program Files\elasticsearch-6.5.1\lib\elasticsearch-rest-high-level-client-6.5.1.jar
                at org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:277) ~[elasticsearch-core-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:190) ~[elasticsearch-core-6.5.1.jar:6.5.1]
                at org.elasticsearch.plugins.PluginsService.checkBundleJarHell(PluginsService.java:515) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:462) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:156) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.node.Node.<init>(Node.java:338) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.5.1.jar:6.5.1]
                at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.5.1.jar:6.5.1]
                ... 6 more

Pom.xml

                <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <modelVersion>4.0.0</modelVersion>
          <groupId>org.elasticsearch.client</groupId>
          <artifactId>elasticsearch-rest-high-level-client</artifactId>
          <version>6.5.1</version>
          <dependencies>
            <dependency>
              <groupId>org.elasticsearch</groupId>
              <artifactId>elasticsearch</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>org.elasticsearch.client</groupId>
              <artifactId>elasticsearch-rest-client</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>org.elasticsearch.client</groupId>
                <artifactId>elasticsearch-rest-client-sniffer</artifactId>
                <version>6.5.1</version>
           </dependency>
            <dependency>
              <groupId>org.elasticsearch.plugin</groupId>
              <artifactId>parent-join-client</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>org.elasticsearch.plugin</groupId>
              <artifactId>aggs-matrix-stats-client</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>org.elasticsearch.plugin</groupId>
              <artifactId>rank-eval-client</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>org.elasticsearch.plugin</groupId>
              <artifactId>lang-mustache-client</artifactId>
              <version>6.5.1</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-databind</artifactId>
              <version>2.8.11.3</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-core</artifactId>
              <version>2.8.10</version>
              <scope>compile</scope>
            </dependency>
            <dependency>
              <groupId>org.apache.logging.log4j</groupId>
              <artifactId>log4j-core</artifactId>
              <version>2.11.1</version>
              <scope>compile</scope>
           </dependency>
           <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.25</version>
         </dependency>
           <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
                <version>2.8.2</version>
            </dependency>

          </dependencies>

          <inceptionYear>2009</inceptionYear>
          <licenses>
            <license>
              <name>The Apache Software License, Version 2.0</name>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
              <distribution>repo</distribution>
            </license>
          </licenses>
          <developers>
            <developer>
              <name>Elastic</name>
              <url>http://www.elastic.co</url>
            </developer>
          </developers>
          <name>rest-high-level</name>
          <description>Elasticsearch subproject :client:rest-high-level</description>
          <url>https://github.com/elastic/elasticsearch</url>
          <scm>
            <url>git@github.com:elastic/elasticsearch.git</url>
          </scm>
        </project>

我做了谷歌,发现这个错误是关于

  

冲突jar文件

Ide:我的月食

任何建议都是最欢迎的。

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题

Jar Hell与Jar冲突有关

第1步

在src / test / java中创建类

JarHell.java

   package org.elasticsearch.bootstrap;
   import java.net.URL;
   import java.util.Set;
   public class JarHell {
   private JarHell() {}
   public static void checkJarHell() throws Exception {}
   public static void checkJarHell(URL urls[]) throws Exception {}
   public static void checkVersionFormat(String targetVersion) {}
   public static void checkJavaVersion(String resource, String targetVersion) {}
   public static Set<URL> parseClassPath() {return ImmutableSet.of();}
   }

Step2 ImmutableSet.java

package org.elasticsearch.bootstrap;
import java.net.URL; 
import java.util.Set;
public class ImmutableSet {

public static Set<URL> of() {
    // TODO Auto-generated method stub
    return null;
 }

 }
  

jar1:C:\ Program Files \ elasticsearch-6.5.1 \ modules \ x-pack-core \ x-pack-core-6.5.1.jar

     

jar2:C:\ Program Files \ elasticsearch-6.5.1 \ lib \ elasticsearch-rest-high-level-client-6.5.1.jar

我已从lib文件夹中删除了elasticsearch-rest-high-level-client jar文件。

打起精神,解决了我的问题。

谢谢