java - Maven build throws JodaTime Exception at runtime -


i'm building 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 exception after getting far:

adding annotator tokenize adding annotator ssplit adding annotator pos reading pos tagger model edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.2 sec]. adding annotator lemma adding annotator ner loading classifier edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [4.8 sec]. loading classifier edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [2.3 sec]. loading classifier 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     @ edu.stanford.nlp.time.sutime$duration.compareto(sutime.java:3671)     @ edu.stanford.nlp.time.sutime$duration.max(sutime.java:3753)     @ edu.stanford.nlp.time.sutime$time.difference(sutime.java:1434)     @ edu.stanford.nlp.time.sutime$range.<init>(sutime.java:4072)     @ edu.stanford.nlp.time.sutime.<clinit>(sutime.java:655)     @ edu.stanford.nlp.time.englishtimeexpressionpatterns.inittimeunitsmap(englishtimeexpressionpatterns.java:1542)     @ edu.stanford.nlp.time.englishtimeexpressionpatterns.<init>(englishtimeexpressionpatterns.java:47)     @ edu.stanford.nlp.time.timeexpressionextractorimpl.init(timeexpressionextractorimpl.java:65)     @ edu.stanford.nlp.time.timeexpressionextractorimpl.<init>(timeexpressionextractorimpl.java:37)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:57)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)     @ java.lang.reflect.constructor.newinstance(constructor.java:526)     @ java.lang.class.newinstance(class.java:374)     @ edu.stanford.nlp.time.timeexpressionextractorfactory.create(timeexpressionextractorfactory.java:45)     @ edu.stanford.nlp.time.timeexpressionextractorfactory.createextractor(timeexpressionextractorfactory.java:28)     @ edu.stanford.nlp.ie.regexp.numbersequenceclassifier.<init>(numbersequenceclassifier.java:79)     @ edu.stanford.nlp.ie.nerclassifiercombiner.<init>(nerclassifiercombiner.java:67)     @ edu.stanford.nlp.pipeline.stanfordcorenlp$6.create(stanfordcorenlp.java:619)     @ edu.stanford.nlp.pipeline.annotatorpool.get(annotatorpool.java:81)     @ edu.stanford.nlp.pipeline.stanfordcorenlp.construct(stanfordcorenlp.java:260)     @ edu.stanford.nlp.pipeline.stanfordcorenlp.<init>(stanfordcorenlp.java:127)     @ edu.stanford.nlp.pipeline.stanfordcorenlp.<init>(stanfordcorenlp.java:123)     @ com.othermaps.analysis.madhatter.service.serviceimpl.inittaengines(serviceimpl.java:49)     ... 34 more 

i'm assuming 'wrong version of jodatime' issue -- can't find version doesn't generate exception, if explicitly exclude jodatime artifact 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 explicit-defined version manually

eg

<dependency>     <groupid>joda-time</groupid>     <artifactid>joda-time</artifactid>     <version>2.1</version> </dependency> 

(yes know that's same version automatically-added dependency: example of process i've tried ;-)

all appreciated.

d

my last comment contains answer -- conflict joda jar included in cxf bundle.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -