【问题标题】:Jackson jar hell when installing my plugin on elasticsearch在 elasticsearch 上安装我的插件时杰克逊 jar 地狱
【发布时间】:2018-05-27 20:23:43
【问题描述】:

我正在为 Elasticsearch 编写一个自定义插件,这个插件依赖于 Jackson 库。当我在 Elasticsearch 上安装插件时,我收到了这个错误:

线程 "main" java.lang.IllegalStateException 中的异常:由于 jar hell 无法加载插件 AdapterPlugin 引起:java.lang.IllegalStateException: jar 地狱! 类:com.fasterxml.jackson.core.Base64Variant jar1: C:\elasticsearch-6.2.4\lib\jackson-core-2.8.10.jar jar2: C:\elasticsearch-6.2.4\plugins.installing-4501343069579282727\jackson-core-2.8.10.jar 在 org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:275) 在 org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:192) 在 org.elasticsearch.plugins.PluginsService.checkBundleJarHell(PluginsService.java:473) ... 12 更多

我该如何解决这个问题?如您所见,我试图将我的 Jackson 版本从最新版本更改为 2.8.10(弹性 6.2.4 使用它),但这并没有帮助。

我正在使用 maven,这是我用于 cuatom 插件的 pox.xml 文件:

<dependencies>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>6.2.4</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.10</version>
    </dependency>


</dependencies>

【问题讨论】:

    标签: java maven elasticsearch


    【解决方案1】:

    如何在类路径中包含依赖项?马文?摇篮?需要更多信息。如果您使用 Maven,则可以在添加 Elasticsearch 时使用排除项并自己包含 jackson 库:

    <project>
      ...
      <dependencies>
        <dependency>
          <groupId>org.elasticsearch</groupId>
          <artifactId>elasticsearch</artifactId>
          <version>6.2.4</version>
          <scope>compile</scope>
          <exclusions>
            <exclusion>  <!-- declare the exclusion here -->
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-core</artifactId>
            </exclusion>
          </exclusions> 
        </dependency>
      </dependencies>
    </project>
    

    【讨论】:

    • 是的,我正在使用 Maven。但我尝试了您的解决方案,但仍然遇到同样的错误。
    • 这意味着你可能配置 maven 错误。你能用你的 pom 文件更新问题吗?
    • SOF 不允许我添加更多代码,因为我的描述很短。我在帖子中添加了依赖项,够吗?
    • 是的,但你不排除任何东西。请参阅我的代码,了解如何从另一个中排除某个依赖项。
    • 我尝试了您的解决方案,但仍然遇到与我告诉您的相同的错误。唯一的区别是我的弹性范围是“提供”的。这是个问题吗?
    猜你喜欢
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 2020-04-12
    • 1970-01-01
    • 2014-10-15
    • 1970-01-01
    • 2012-01-11
    • 2011-08-25
    相关资源
    最近更新 更多