Jar hell when installing custom plugin

I'm trying to install a custom plugin I'm working on which includes CoreNLP. I'm getting the jar hell error with the following jars:

Caused by: java.lang.IllegalStateException: jar hell!
class: com.sun.xml.bind.Locatable
jar1: /usr/share/elasticsearch/plugins/.installing-6011384642713418918/jaxb-impl-2.4.0-b180830.0438.jar
jar2: /usr/share/elasticsearch/plugins/.installing-6011384642713418918/jaxb-core-2.3.0.1.jar
    at org.elasticsearch.bootstrap.JarHell.checkClass(JarHell.java:277)
    at org.elasticsearch.bootstrap.JarHell.checkJarHell(JarHell.java:190)
    at org.elasticsearch.plugins.PluginsService.checkBundleJarHell(PluginsService.java:503)
    ... 12 more

What am I doing wrong? Thanks.

Your plugin seems to have 2 jaxb implementations (different versions and artifact names). You should fix it by checking the dependency tree of your plugin.

I'm only using coreNLP so I'm not sure whats happening. Here's the dependency section of my pom.xml file. I'm following this exactly, I only bumped the ES and coreNLP versions.

 <dependencies>
    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>3.9.2</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-sandbox</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-analyzers-common</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-queries</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-queryparser</artifactId>
            </exclusion>
            <exclusion>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>3.9.2</version>
        <classifier>models</classifier>
        <exclusions>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-sandbox</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-analyzers-common</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-queries</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-queryparser</artifactId>
            </exclusion>
            <exclusion>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

and below is the truncated output of mvn dependency:tree:

[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

I dont understand why this is causing a jar hell error, the packages are clearly different. They have different names and versions. What gives?

The problem is then in stanford-corenlp

Try to exclude one of the libs may be?

I probably can't do that because they're both explicitly listed as dependencies in CoreNLP's pom.xml. Anyway, I found another alternative to what I'm doing so I don't need to fix this. Thanks for your help though.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.