Maven build throws JodaTime Exception at runtime

I'm building a maven-based java application using corenlp 3.3.1.

The salient pom.xml dependencies are

        <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>3.3.1</version>
        </dependency>

        <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>3.3.1</version>
            <classifier>models</classifier>
        </dependency>

Running

 mvn dependency:tree

gives:

[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- edu.stanford.nlp:stanford-corenlp:jar:3.3.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] |  +- joda-time:joda-time:jar:2.1:compile
[INFO] |  +- de.jollyday:jollyday:jar:0.4.7:compile
[INFO] |  |  \- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] |  \- com.googlecode.efficient-java-matrix-library:ejml:jar:0.23:compile
[INFO] \- edu.stanford.nlp:stanford-corenlp:jar:models:3.3.1:compile

My code includes:

Properties props = new Properties();
            props.put("annotators",
                    "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
            this.pipeline = new StanfordCoreNLP(props);

This throws an exception after getting this far:

Adding annotator tokenize
Adding annotator ssplit
Adding annotator pos
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.2 sec].
Adding annotator lemma
Adding annotator ner
Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [4.8 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [2.3 sec].
Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [3.8 sec].

The Exception is

java.lang.NoSuchMethodError: org.joda.time.Duration.compareTo(Lorg/joda/time/ReadableDuration;)I
    at edu.stanford.nlp.time.SUTime$Duration.compareTo(SUTime.java:3671)
    at edu.stanford.nlp.time.SUTime$Duration.max(SUTime.java:3753)
    at edu.stanford.nlp.time.SUTime$Time.difference(SUTime.java:1434)
    at edu.stanford.nlp.time.SUTime$Range.<init>(SUTime.java:4072)
    at edu.stanford.nlp.time.SUTime.<clinit>(SUTime.java:655)
    at edu.stanford.nlp.time.EnglishTimeExpressionPatterns.initTimeUnitsMap(EnglishTimeExpressionPatterns.java:1542)
    at edu.stanford.nlp.time.EnglishTimeExpressionPatterns.<init>(EnglishTimeExpressionPatterns.java:47)
    at edu.stanford.nlp.time.TimeExpressionExtractorImpl.init(TimeExpressionExtractorImpl.java:65)
    at edu.stanford.nlp.time.TimeExpressionExtractorImpl.<init>(TimeExpressionExtractorImpl.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.lang.Class.newInstance(Class.java:374)
    at edu.stanford.nlp.time.TimeExpressionExtractorFactory.create(TimeExpressionExtractorFactory.java:45)
    at edu.stanford.nlp.time.TimeExpressionExtractorFactory.createExtractor(TimeExpressionExtractorFactory.java:28)
    at edu.stanford.nlp.ie.regexp.NumberSequenceClassifier.<init>(NumberSequenceClassifier.java:79)
    at edu.stanford.nlp.ie.NERClassifierCombiner.<init>(NERClassifierCombiner.java:67)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP$6.create(StanfordCoreNLP.java:619)
    at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:81)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:260)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:127)
    at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:123)
    at com.othermaps.analysis.madhatter.service.ServiceImpl.initTAEngines(ServiceImpl.java:49)
    ... 34 more

I'm assuming that this is a 'wrong version of JodaTime' issue -- however I can't find a version which doesn't generate this Exception, if I explicitly exclude the JodaTime artifact from the dependencies of corenlp:

<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>3.3.1</version>
        <exclusions>
            <exclusion>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
            </exclusion>
        </exclusions>
</dependency>

and add an explicit-defined version manually

eg

<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.1</version>
</dependency>

(Yes I know that's the same version as the automatically-added dependency: this is just an example of the process I've tried ;-)

All help appreciated.

D

Answers


My last comment contains the answer -- it was a conflict with a Joda jar included in a CXF bundle.


Need Your Help

How to find MAX or MIN in Verilog coding?

max verilog

the question is simple, I heared that assign out = (a&gt;b)?a:b is wrong. is it wrong? if it is, is there another way to find MAX?

adding search bar under the navigation bar?

iphone objective-c cocoa-touch

i want to add a search bar under the navigation bar with uitableview.