罐地狱与两个不相关的罐子

时间:2019-01-20 14:23:16

标签: java maven elasticsearch

我正在尝试构建Elasticsearch插件,当我使用Maven进行构建时,没有任何错误。但是,当我尝试安装它时,出现错误消息:

  

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

     

原因:java.lang.IllegalStateException:罐子地狱!类:   com.sun.xml.bind.Locableable 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)

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

[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

1 个答案:

答案 0 :(得分: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插件基础结构发生冲突。