0

I'm trying to use Stanford CoreNLP in my Android application so I included this in my build.gradle:

implementation 'edu.stanford.nlp:stanford-corenlp:4.0.0'

I then created a Pipeline class in Kotlin and this is the code for that:

object Pipeline {
    private var properties: Properties? = null
    private const val propertiesName = "pos"
    private var stanfordCoreNLP: StanfordCoreNLP? = null

    val pipeline: StanfordCoreNLP
        get() {
            if (stanfordCoreNLP == null) {
                stanfordCoreNLP = StanfordCoreNLP(properties)
            }
            return stanfordCoreNLP as StanfordCoreNLP
        }

    init {
        properties = Properties()
        properties!!.setProperty("annotators", propertiesName)
    }
}

To make use of the Pipeline class, I included this in my MainActivity:

stanfordCoreNLP = Pipeline.pipeline
coreDocument = CoreDocument(text)
stanfordCoreNLP.annotate(coreDocument)
coreLabelList = coreDocument.tokens()
for (coreLabel: CoreLabel in coreLabelList) {
    val pos: String =
        coreLabel.get(CoreAnnotations.PartOfSpeechAnnotation::class.java)
    if (pos == "NN") {
        print(coreLabel.originalText() + " " + pos + ", ")
    }
}

I created the stanfordCoreNLP, coreDocument, and coreLabelList at the top of my activity like this:

private lateinit var stanfordCoreNLP: StanfordCoreNLP
private lateinit var coreDocument: CoreDocument
private lateinit var coreLabelList: List<CoreLabel>

When I try to build my application, it crashes. This is what I get in the console:

Duplicate class com.sun.xml.bind.Locatable found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.Messages found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.Util found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.WhiteSpaceProcessor found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.annotation.OverrideAnnotationOf found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.annotation.XmlIsSet found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.annotation.XmlLocation found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.ErrorListener found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.impl.NameConverter found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.impl.NameConverter$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.impl.NameConverter$2 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.impl.NameConverter$Standard found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.api.impl.NameUtil found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.CharacterEscapeHandler found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.DataWriter found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.DumbEscapeHandler found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.Messages found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.MinimumEscapeHandler found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.NoEscapeHandler found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.SAX2DOMEx found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.marshaller.XMLWriter found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.unmarshaller.DOMScanner found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.unmarshaller.InfosetScanner found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.util.SecureLoader found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.util.SecureLoader$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.util.SecureLoader$2 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.util.SecureLoader$3 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.util.Which found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.ClassFactory found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.ClassFactory$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.ClassFactory$2 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.Messages found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.TODO found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.WellKnownNamespace found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.annotation.AnnotationReader found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.annotation.AnnotationSource found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.annotation.Locatable found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.Adapter found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ArrayInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.AttributePropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.BuiltinLeafInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ClassInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.Element found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ElementInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ElementPropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.EnumConstant found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.EnumLeafInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ErrorHandler found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ID found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.LeafInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.MapPropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.MaybeElement found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.NonElement found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.NonElementRef found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.PropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.PropertyKind found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.Ref found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ReferencePropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.RegistryInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.TypeInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.TypeInfoSet found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.TypeRef found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.ValuePropertyInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.WildcardMode found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.WildcardTypeInfo found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.core.package-info found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.impl.ModelBuilderI found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.GenericArrayTypeImpl found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.Navigator found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ParameterizedTypeImpl found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$10 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$2 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$3 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$4 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$5 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$6 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$7 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$8 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$9 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.ReflectionNavigator$BinderArg found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.SecureLoader found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.SecureLoader$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.SecureLoader$2 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.SecureLoader$3 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.TypeVisitor found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.nav.WildcardTypeImpl found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.model.util.ArrayInfoUtil found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.IllegalAnnotationException found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.Location found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.RuntimeUtil found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.RuntimeUtil$ToStringAdapter found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.SwaRefAdapterMarker found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.unmarshaller.LocatorEx found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.runtime.unmarshaller.LocatorEx$Snapshot found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.schemagen.episode.Bindings found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.schemagen.episode.Klass found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.schemagen.episode.Package found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.schemagen.episode.SchemaBindings found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.schemagen.episode.package-info found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.util.EditDistance found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.util.FlattenIterator found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.util.XmlFactory found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)
Duplicate class com.sun.xml.bind.v2.util.XmlFactory$1 found in modules jetified-jaxb-core-2.3.0.1.jar (com.sun.xml.bind:jaxb-core:2.3.0.1) and jetified-jaxb-impl-2.4.0-b180830.0438.jar (com.sun.xml.bind:jaxb-impl:2.4.0-b180830.0438)

Go to the documentation to learn how to Fix dependency resolution errors.

How do I fix this?

Bert Hanz
  • 417
  • 1
  • 7
  • 16
  • I don't know much about Android or gradle...it's possible you could resolve this by removing jars from the libs folder and dependencies from the gradle build file...also you may be able to force the project to use certain versions in your gradle build file...here is an example SO answer on this topic: https://stackoverflow.com/questions/36990054/android-studio-resolving-duplicate-classes – StanfordNLPHelp Aug 06 '20 at 03:23
  • https://stackoverflow.com/questions/56029393/why-im-getting-duplicate-class-when-running-my-android-project/56029604#56029604 – StanfordNLPHelp Aug 06 '20 at 03:39
  • That above Stack Overflow has a clear answer on what causes these errors. So to summarize CoreNLP brings in a lot of dependencies with it, and that is somehow conflicting with the dependencies of the overall project. I'm not sure how many of those dependencies are needed if you just want to run a CoreNLP pipeline, load a model, and annotate some data...it's possible to skip a lot of the CoreNLP dependencies. – StanfordNLPHelp Aug 06 '20 at 03:41

1 Answers1

0

I left some comments as well, but basically CoreNLP is bringing in dependencies along with it that are conflicting with the project. I did an experiment and was able to run a CoreNLP pipeline with tokenize,ssplit,pos that had NONE of the CoreNLP dependencies. So if you are just running a pipeline, you should be able to get rid of all of CoreNLP's dependencies and that may help resolve this issue.

StanfordNLPHelp
  • 8,699
  • 1
  • 11
  • 9
  • One thing to remember, if you run a more elaborate pipeline with more annotators, you may need to add some of the dependencies back in, I was just referring to tokenize,ssplit,pos...for instance depparse would need the ejml stuff, etc... – StanfordNLPHelp Aug 06 '20 at 03:48
  • If you had none of the CoreNLP dependencies, then how did you import `StanfordCoreNLP`? – Bert Hanz Aug 06 '20 at 03:52
  • You need stanford-corenlp-4.1.0.jar and stanford-corenlp-4.1.0-models.jar ...I meant the 3rd party dependencies. – StanfordNLPHelp Aug 06 '20 at 04:04
  • CoreNLP for instance has a bunch of jaxb dependencies, that I don't think are actually related to running a simple pipeline, so you could get rid of those jars and the pipeline should still run. – StanfordNLPHelp Aug 06 '20 at 04:06
  • I don't know how successful people have been at running a part of speech tagger in their Android apps, but I should note that you can remove a lot of the stuff from the jars if you run into size issues...you only need a few classes and files, not the entirety of CoreNLP – StanfordNLPHelp Aug 06 '20 at 04:07
  • Were you able to run your experiment on an Android app? The CoreNLP Jar zip file is 481 MB which is pretty heavy so I'm not sure exactly which files to remove and where to place those files as I didn't originally use any of them. – Bert Hanz Aug 06 '20 at 04:40
  • You need stanford-corenlp-4.1.0.jar (for the classes), and the only file you need from the models jar is edu/stanford/nlp/models/pos-tagger/english-left3words-distsim.tagger – StanfordNLPHelp Aug 06 '20 at 05:06
  • So I have a total of three files now. I placed the `stanford-corenlp-4.1.0.jar` in my `libs` folder and I placed the `english-left3words-distsim.tagger.props` and `english-left3words-distsim.tagger` in my `assets` folder. How should I modify my code above to make use of my `.props` file and `.tagger` file? – Bert Hanz Aug 06 '20 at 05:32
  • You don't need the props file. If you want the model to load automatically, you need to place it in a jar file with the full path (same as is in the models jar). Or you can leave it in the assets folder and add the pos.model property to your pipeline, and set that to the path to the model file. – StanfordNLPHelp Aug 06 '20 at 07:02
  • So I want to leave it in the assets folder. I'm bit confused to how to add it to the pos.model property to my pipeline. I got rid of the `english-left3words-distsim.tagger.props` and just have the `english-left3words-distsim.tagger`. What do I add/modify to my code? – Bert Hanz Aug 06 '20 at 18:02
  • In the same manner you set the annotators property, set the pos.model property with the full path to the tagger model file. – StanfordNLPHelp Aug 06 '20 at 22:42