【问题标题】:jar hell with two unrelated jars有两个不相关的罐子的罐子地狱
【发布时间】:2019-01-21 00:42:30
【问题描述】:

我正在尝试构建一个 Elasticsearch 插件,当我使用 Maven 构建它时,我没有收到任何错误。但是,当我尝试安装它时,我收到一条错误消息:

由于 jar hell 无法加载插件 es-corenlp

原因:java.lang.IllegalStateException: jar hell!班级: com.sun.xml.bind.Locatable jar1: /usr/share/elasticsearch/plugins/.installing-10579885053273466174/jaxb-impl-2.4.0-b180830.0438.jar

jar2: /usr/share/elasticsearch/plugins/.installing-10579885053273466174/jaxb-core-2.3.0.1.jar 在 org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:277)

请注意,这两个 jar 具有不同的名称和版本。为什么会这样?

[INFO] es-corenlp:es-corenlp:jar:1.0-SNAPSHOT
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:3.9.2:compile
[INFO] | +- com.apple:AppleJavaExtensions:jar:1.4:compile
[INFO] | +- de.jollyday:jollyday:jar:0.4.9:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.3.1:compile
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] | +- com.io7m.xom:xom:jar:1.2.10:compile
[INFO] | | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | | - xalan:xalan:jar:2.7.0:compile
[INFO] | +- com.googlecode.efficient-java-matrix-library:ejml:jar:0.23:compile
[INFO] | +- org.glassfish:javax.json:jar:1.0.4:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.2.0:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.4.0-b180830.0359:compile
[INFO] | +- com.sun.xml.bind:jaxb-core:jar:2.3.0.1:compile
[INFO] | - com.sun.xml.bind:jaxb-impl:jar:2.4.0-b180830.0438:compile
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:models:3.9.2:compile

【问题讨论】:

  • 从您的 maven 构建发布 mvn dependency:tree
  • @karoldowbecki 发布

标签: java maven elasticsearch


【解决方案1】:

根据您的依赖关系树 edu.stanford.nlp:stanford-corenlp:jar:3.9.2 混合了 JAXB 版本。您可以通过将正确版本中的 jaxb-impl 依赖项添加到您的 pom.xml 来自己强制版本:

<dependency>
  <groupId>com.sun.xml.bind</groupId>
   <artifactId>jaxb-impl</artifactId>
   <version>2.3.0.1</version>
</dependency>

stanford-corenlp 可能在独立模式下工作,但会与 Elastic 插件基础架构发生冲突。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-28
    相关资源
    最近更新 更多