微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – 斯坦福CoreNLP在jetty应用程序中部署时无法找到正确版本的ejml

有许多类似的问题,人们在StanfordNLP中使用SentimentAnalysis库时会出现如下错误

java.io.InvalidClassException: org.ejml.simple.SimpleBase; local class incompatible: stream classdesc serialVersionUID = 7560584869544985034, local class serialVersionUID = -5535333403571293496
at edu.stanford.nlp.sentiment.SentimentModel.loadSerialized(SentimentModel.java:629)
at edu.stanford.nlp.pipeline.SentimentAnnotator.<init>(SentimentAnnotator.java:54)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.sentiment(AnnotatorImplementations.java:241)
at edu.stanford.nlp.pipeline.AnnotatorFactories$16.create(AnnotatorFactories.java:571)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:375)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:139)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:135)
at com.ccri.crusher.slotfiller.SentimentAnalyzer$.<init>(SentimentSayer.scala:31)
at com.ccri.crusher.slotfiller.SentimentAnalyzer$.<clinit>(SentimentSayer.scala)

然后人们告诉他们将这个ejml(来自谷歌的矩阵库)添加到他们的类路径:scala error acessing stanford corenlp sentiment – local class incompatible

这是另一个类似的问题:
Getting the error while integrating stanford sentiment analysis with java

它甚至在github问题上得到了解答:https://github.com/stanfordnlp/CoreNLP/issues/8

但是在编译时我没有收到错误消息,当我打开mvn:scala控制台时也没有得到它.它的工作非常出色.

启动mvn:jetty Web服务器并以这种方式访问​​类后,我收到错误.

我尝试在我的项目中的许多地方添加依赖项,包括父级pom,模块级pom,以及作为mvn jetty插件的依赖项,都具有相同的结果.这是我添加的依赖项:

<!-- https://mvnrepository.com/artifact/com.googlecode.efficient-java-matrix-library/ejml -->
<dependency>
    <groupId>com.googlecode.efficient-java-matrix-library</groupId>
    <artifactId>ejml</artifactId>
    <version>0.23</version>
</dependency>

这与我的Stanford CoreNLP版本运行的版本相同(3.6或3.7(从源代码编译)).

我怀疑jetty有自己版本的“ejml”,它在斯坦福大学强制使用,而不是像我上面指定的那样使用版本0.23的ejml.

我已经尝试过斯坦福和ejml的多个版本但没有成功.

更新:在尝试了很多不同版本的Stanford和ejml之后,看到流与本地版本没有一点变化,我确信问题不存在.也许这与我的.war与我的.jar中的scala / java版本不同?

Update2:mvn:战争的依赖树(当我使用ejml .21时):

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building crusher-war 1.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ crusher-war ---
[INFO] com.ccri.crusher:crusher-war:war:1.1.0-SNAPSHOT
[INFO] +- com.ccri.commons:commons-scalatra_2.11:jar:1.1:compile
[INFO] |  +- org.scalatra:scalatra_2.11:jar:2.3.0:compile
[INFO] |  |  +- org.scalatra:scalatra-common_2.11:jar:2.3.0:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] |  |  +- org.clapper:grizzled-slf4j_2.11:jar:1.0.2:compile
[INFO] |  |  +- org.scalatra.rl:rl_2.11:jar:0.4.10:compile
[INFO] |  |  +- com.googlecode.juniversalchardet:juniversalchardet:jar:1.0.3:compile
[INFO] |  |  +- eu.medsea.mimeutil:mime-util:jar:2.1.3:compile
[INFO] |  |  +- joda-time:joda-time:jar:2.3:compile
[INFO] |  |  +- org.joda:joda-convert:jar:1.6:compile
[INFO] |  |  +- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.1:compile
[INFO] |  |  \- org.scala-lang.modules:scala-xml_2.11:jar:1.0.2:compile
[INFO] |  +- org.json4s:json4s-jackson_2.11:jar:3.2.10:compile
[INFO] |  |  +- org.json4s:json4s-core_2.11:jar:3.2.10:compile
[INFO] |  |  |  +- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
[INFO] |  |  |  \- org.scala-lang:scalap:jar:2.11.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.3.1:compile
[INFO] |  |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO] |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.3.1:compile
[INFO] |  +- org.scalatra:scalatra-json_2.11:jar:2.3.0:compile
[INFO] |  +- org.scalatra:scalatra-scalate_2.11:jar:2.3.0:compile
[INFO] |  |  \- org.scalatra.scalate:scalate-core_2.11:jar:1.7.0:compile
[INFO] |  |     +- org.scalatra.scalate:scalate-util_2.11:jar:1.7.0:compile
[INFO] |  |     \- org.scala-lang:scala-compiler:jar:2.11.0:compile
[INFO] |  +- org.springframework:spring-web:jar:3.1.4.RELEASE:compile
[INFO] |  |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:3.1.4.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:3.1.4.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-context:jar:3.1.4.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-expression:jar:3.1.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-core:jar:3.1.4.RELEASE:compile
[INFO] |  |     \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  \- com.typesafe.scala-logging:scala-logging_2.11:jar:3.1.0:compile
[INFO] |     \- org.scala-lang:scala-reflect:jar:2.11.1:compile
[INFO] +- com.ccri.dragonfish:Meta-web-utils:jar:1.7.1:compile
[INFO] |  +- com.ccri.dragonfish:sparql-utils:jar:1.7.1:compile
[INFO] |  |  +- org.openrdf.sesame:sesame-query:jar:2.7.6:compile
[INFO] |  |  |  \- org.openrdf.sesame:sesame-rio-api:jar:2.7.6:compile
[INFO] |  |  +- com.ccri.commons:sparql-endpoint_2.11:jar:1.1.4:compile
[INFO] |  |  +- org.apache.rya:rya.api:jar:3.2.10-ccri:compile
[INFO] |  |  |  +- org.calrissian.mango:mango-core:jar:1.2.0:compile
[INFO] |  |  |  |  \- commons-net:commons-net:jar:3.3:compile
[INFO] |  |  |  +- org.openrdf.sesame:sesame-queryalgebra-model:jar:2.7.6:compile
[INFO] |  |  |  +- org.openrdf.sesame:sesame-queryalgebra-evaluation:jar:2.7.6:compile
[INFO] |  |  |  |  +- org.openrdf.sesame:sesame-repository-sparql:jar:2.7.6:compile
[INFO] |  |  |  |  |  +- org.openrdf.sesame:sesame-repository-api:jar:2.7.6:compile
[INFO] |  |  |  |  |  +- org.openrdf.sesame:sesame-queryparser-api:jar:2.7.6:compile
[INFO] |  |  |  |  |  +- org.openrdf.sesame:sesame-queryparser-sparql:jar:2.7.6:compile
[INFO] |  |  |  |  |  \- org.openrdf.sesame:sesame-queryresultio-sparqlxml:jar:2.7.6:compile
[INFO] |  |  |  |  \- org.openrdf.sesame:sesame-http-client:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-http-protocol:jar:2.7.6:compile
[INFO] |  |  |  |     \- org.openrdf.sesame:sesame-queryresultio-api:jar:2.7.6:compile
[INFO] |  |  |  +- com.google.guava:guava:jar:18.0:compile
[INFO] |  |  |  \- org.apache.hadoop:hadoop-common:jar:2.5.2:compile
[INFO] |  |  |     +- org.apache.hadoop:hadoop-annotations:jar:2.5.2:compile
[INFO] |  |  |     |  \- jdk.tools:jdk.tools:jar:1.6:system
[INFO] |  |  |     +- xmlenc:xmlenc:jar:0.52:compile
[INFO] |  |  |     +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |  |  |     +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] |  |  |     +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] |  |  |     +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] |  |  |     +- com.sun.jersey:jersey-core:jar:1.9:compile
[INFO] |  |  |     +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] |  |  |     |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  |  |     |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] |  |  |     |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
[INFO] |  |  |     |  \- org.codehaus.jackson:jackson-xc:jar:1.8.3:compile
[INFO] |  |  |     +- com.sun.jersey:jersey-server:jar:1.9:compile
[INFO] |  |  |     |  \- asm:asm:jar:3.1:compile
[INFO] |  |  |     +- tomcat:jasper-compiler:jar:5.5.23:runtime
[INFO] |  |  |     +- tomcat:jasper-runtime:jar:5.5.23:runtime
[INFO] |  |  |     +- javax.servlet.jsp:jsp-api:jar:2.1:runtime
[INFO] |  |  |     +- commons-el:commons-el:jar:1.0:runtime
[INFO] |  |  |     +- net.java.dev.jets3t:jets3t:jar:0.9.0:compile
[INFO] |  |  |     |  \- com.jamesmurty.utils:java-xmlbuilder:jar:0.4:compile
[INFO] |  |  |     +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] |  |  |     +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  |  |     +- org.apache.avro:avro:jar:1.7.4:compile
[INFO] |  |  |     |  \- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] |  |  |     +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] |  |  |     +- org.apache.hadoop:hadoop-auth:jar:2.5.2:compile
[INFO] |  |  |     |  \- org.apache.directory.server:apacheds-kerberos-codec:jar:2.0.0-M15:compile
[INFO] |  |  |     |     +- org.apache.directory.server:apacheds-i18n:jar:2.0.0-M15:compile
[INFO] |  |  |     |     +- org.apache.directory.api:api-asn1-api:jar:1.0.0-M20:compile
[INFO] |  |  |     |     \- org.apache.directory.api:api-util:jar:1.0.0-M20:compile
[INFO] |  |  |     +- com.jcraft:jsch:jar:0.1.42:compile
[INFO] |  |  |     \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  |  +- org.apache.rya:accumulo.rya:jar:3.2.10-ccri:compile
[INFO] |  |  |  +- org.openrdf.sesame:sesame-rio-ntriples:jar:2.7.6:compile
[INFO] |  |  |  \- org.openrdf.sesame:sesame-rio-nquads:jar:2.7.6:compile
[INFO] |  |  +- org.apache.rya:rya.indexing:jar:3.2.10-ccri:compile
[INFO] |  |  |  +- org.apache.rya:rya.sail:jar:3.2.10-ccri:compile
[INFO] |  |  |  |  +- org.apache.rya:rya.provenance:jar:3.2.10-ccri:compile
[INFO] |  |  |  |  +- net.sf.ehcache:ehcache-core:jar:1.7.2:compile
[INFO] |  |  |  |  +- com.tinkerpop.blueprints:blueprints-core:jar:2.5.0:compile
[INFO] |  |  |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-json-org:jar:2.2.3:compile
[INFO] |  |  |  |  |  |  \- org.json:json:jar:20090211:compile
[INFO] |  |  |  |  |  \- colt:colt:jar:1.2.0:compile
[INFO] |  |  |  |  |     \- concurrent:concurrent:jar:1.3.4:compile
[INFO] |  |  |  |  \- org.openrdf.sesame:sesame-runtime:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-repository-manager:jar:2.7.6:compile
[INFO] |  |  |  |     |  \- org.openrdf.sesame:sesame-repository-event:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-repository-http:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-repository-contextaware:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-repository-sail:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-sail-api:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-sail-federation:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-queryparser-serql:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-queryresultio-binary:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-queryresultio-sparqljson:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-queryresultio-text:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-repository-dataset:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-rio-binary:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-rio-n3:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-rio-rdfjson:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-rio-rdfxml:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-rio-trix:jar:2.7.6:runtime
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-sail-inferencer:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-sail-memory:jar:2.7.6:compile
[INFO] |  |  |  |     +- org.openrdf.sesame:sesame-sail-nativerdf:jar:2.7.6:runtime
[INFO] |  |  |  |     \- org.openrdf.sesame:sesame-sail-rdbms:jar:2.7.6:runtime
[INFO] |  |  |  |        \- commons-dbcp:commons-dbcp:jar:1.3:runtime
[INFO] |  |  |  +- org.apache.rya:mongodb.rya:jar:3.2.10-ccri:compile
[INFO] |  |  |  |  +- org.mongodb:mongo-java-driver:jar:2.13.3:compile
[INFO] |  |  |  |  \- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.0:compile
[INFO] |  |  |  |     \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.0:compile
[INFO] |  |  |  |        +- net.java.dev.jna:jna:jar:4.0.0:compile
[INFO] |  |  |  |        \- net.java.dev.jna:jna-platform:jar:4.0.0:compile
[INFO] |  |  |  +- org.apache.rya:rya.prospector:jar:3.2.10-ccri:compile
[INFO] |  |  |  |  \- org.codehaus.groovy:groovy-all:jar:2.3.11:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-core:jar:3.6.2:compile
[INFO] |  |  |  +- org.apache.lucene:lucene-analyzers:jar:3.6.2:compile
[INFO] |  |  |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  |  |  \- org.locationtech.geomesa:geomesa-accumulo-datastore:jar:1.2.0:compile
[INFO] |  |  |     +- org.locationtech.geomesa:geomesa-filter:jar:1.2.0:compile
[INFO] |  |  |     |  \- org.geotools:gt-transform:jar:14.1:compile
[INFO] |  |  |     +- org.locationtech.geomesa:geomesa-security:jar:1.2.0:compile
[INFO] |  |  |     +- org.locationtech.geomesa:geomesa-feature-all:jar:1.2.0:compile
[INFO] |  |  |     |  +- org.locationtech.geomesa:geomesa-feature-common:jar:1.2.0:compile
[INFO] |  |  |     |  +- org.locationtech.geomesa:geomesa-feature-kryo:jar:1.2.0:compile
[INFO] |  |  |     |  +- org.locationtech.geomesa:geomesa-feature-avro:jar:1.2.0:compile
[INFO] |  |  |     |  \- org.locationtech.geomesa:geomesa-feature-nio:jar:1.2.0:compile
[INFO] |  |  |     +- org.locationtech.geomesa:geomesa-z3:jar:1.2.0:compile
[INFO] |  |  |     |  \- org.locationtech.sfcurve:sfcurve-zorder_2.11:jar:0.1.1:compile
[INFO] |  |  |     |     \- org.locationtech.sfcurve:sfcurve-api_2.11:jar:0.1.1:compile
[INFO] |  |  |     +- org.geotools:gt-cql:jar:14.1:compile
[INFO] |  |  |     +- org.geotools:gt-render:jar:14.1:compile
[INFO] |  |  |     |  \- org.geotools:gt-coverage:jar:14.1:compile
[INFO] |  |  |     |     +- org.jaitools:jt-zonalstats:jar:1.4.0:compile
[INFO] |  |  |     |     +- org.jaitools:jt-utils:jar:1.4.0:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.affine:jt-affine:jar:1.0.8:compile
[INFO] |  |  |     |     |  +- it.geosolutions.jaiext.iterators:jt-iterators:jar:1.0.8:compile
[INFO] |  |  |     |     |  +- it.geosolutions.jaiext.utilities:jt-utilities:jar:1.0.8:compile
[INFO] |  |  |     |     |  +- it.geosolutions.jaiext.scale:jt-scale:jar:1.0.8:compile
[INFO] |  |  |     |     |  |  \- it.geosolutions.jaiext.translate:jt-translate:jar:1.0.8:compile
[INFO] |  |  |     |     |  \- javax.media:jai_codec:jar:1.1.3:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.algebra:jt-algebra:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.bandmerge:jt-bandmerge:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.bandselect:jt-bandselect:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.bandcombine:jt-bandcombine:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.border:jt-border:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.buffer:jt-buffer:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.crop:jt-crop:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.lookup:jt-lookup:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.mosaic:jt-mosaic:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.nullop:jt-nullop:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.rescale:jt-rescale:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.stats:jt-stats:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.warp:jt-warp:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.zonal:jt-zonal:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.binarize:jt-binarize:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.format:jt-format:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.colorconvert:jt-colorconvert:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.errordiffusion:jt-errordiffusion:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.orderdither:jt-orderdither:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.colorindexer:jt-colorindexer:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.imagefunction:jt-imagefunction:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.piecewise:jt-piecewise:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.classifier:jt-classifier:jar:1.0.8:compile
[INFO] |  |  |     |     +- it.geosolutions.jaiext.rlookup:jt-rlookup:jar:1.0.8:compile
[INFO] |  |  |     |     \- it.geosolutions.jaiext.vectorbin:jt-vectorbin:jar:1.0.8:compile
[INFO] |  |  |     +- org.geotools:gt-process-feature:jar:14.1:compile
[INFO] |  |  |     |  \- org.geotools:gt-process:jar:14.1:compile
[INFO] |  |  |     +- org.apache.commons:commons-csv:jar:1.0:compile
[INFO] |  |  |     \- org.apache.curator:curator-recipes:jar:2.7.1:compile
[INFO] |  |  |        \- org.apache.curator:curator-framework:jar:2.7.1:compile
[INFO] |  |  |           \- org.apache.curator:curator-client:jar:2.7.1:compile
[INFO] |  |  +- org.openrdf.sesame:sesame-rio-trig:jar:2.7.6:compile
[INFO] |  |  |  +- org.openrdf.sesame:sesame-rio-turtle:jar:2.7.6:compile
[INFO] |  |  |  +- org.openrdf.sesame:sesame-rio-datatypes:jar:2.7.6:runtime
[INFO] |  |  |  \- org.openrdf.sesame:sesame-rio-languages:jar:2.7.6:runtime
[INFO] |  |  \- org.apache.accumulo:accumulo-core:jar:1.6.4:compile
[INFO] |  |     +- com.beust:jcommander:jar:1.32:compile
[INFO] |  |     +- commons-cli:commons-cli:jar:1.2:compile
[INFO] |  |     +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |     +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |     |  +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |  |     |  |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |  |     |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  |     +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  |     +- jline:jline:jar:2.11:compile
[INFO] |  |     +- log4j:log4j:jar:1.2.16:compile
[INFO] |  |     +- org.apache.accumulo:accumulo-fate:jar:1.6.4:compile
[INFO] |  |     +- org.apache.accumulo:accumulo-start:jar:1.6.4:compile
[INFO] |  |     +- org.apache.accumulo:accumulo-trace:jar:1.6.4:compile
[INFO] |  |     +- org.apache.commons:commons-math:jar:2.1:compile
[INFO] |  |     +- org.apache.commons:commons-vfs2:jar:2.0:compile
[INFO] |  |     |  +- org.apache.maven.scm:maven-scm-api:jar:1.4:compile
[INFO] |  |     |  |  \- org.codehaus.plexus:plexus-utils:jar:1.5.6:compile
[INFO] |  |     |  \- org.apache.maven.scm:maven-scm-provider-svnexe:jar:1.4:compile
[INFO] |  |     |     +- org.apache.maven.scm:maven-scm-provider-svn-commons:jar:1.4:compile
[INFO] |  |     |     \- regexp:regexp:jar:1.3:compile
[INFO] |  |     +- org.apache.hadoop:hadoop-client:jar:2.2.0:compile
[INFO] |  |     |  +- org.apache.hadoop:hadoop-hdfs:jar:2.2.0:compile
[INFO] |  |     |  +- org.apache.hadoop:hadoop-mapreduce-client-app:jar:2.2.0:compile
[INFO] |  |     |  |  +- org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.2.0:compile
[INFO] |  |     |  |  |  +- org.apache.hadoop:hadoop-yarn-client:jar:2.2.0:compile
[INFO] |  |     |  |  |  |  +- com.google.inject:guice:jar:3.0:compile
[INFO] |  |     |  |  |  |  |  \- javax.inject:javax.inject:jar:1:compile
[INFO] |  |     |  |  |  |  +- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly2:jar:1.9:compile
[INFO] |  |     |  |  |  |  |  +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.9:compile
[INFO] |  |     |  |  |  |  |  |  +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] |  |     |  |  |  |  |  |  \- com.sun.jersey:jersey-client:jar:1.9:compile
[INFO] |  |     |  |  |  |  |  \- com.sun.jersey:jersey-grizzly2:jar:1.9:compile
[INFO] |  |     |  |  |  |  |     +- org.glassfish.grizzly:grizzly-http:jar:2.1.2:compile
[INFO] |  |     |  |  |  |  |     |  \- org.glassfish.grizzly:grizzly-framework:jar:2.1.2:compile
[INFO] |  |     |  |  |  |  |     |     \- org.glassfish.gmbal:gmbal-api-only:jar:3.0.0-b023:compile
[INFO] |  |     |  |  |  |  |     |        \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] |  |     |  |  |  |  |     +- org.glassfish.grizzly:grizzly-http-server:jar:2.1.2:compile
[INFO] |  |     |  |  |  |  |     |  \- org.glassfish.grizzly:grizzly-rcm:jar:2.1.2:compile
[INFO] |  |     |  |  |  |  |     +- org.glassfish.grizzly:grizzly-http-servlet:jar:2.1.2:compile
[INFO] |  |     |  |  |  |  |     \- org.glassfish:javax.servlet:jar:3.1:compile
[INFO] |  |     |  |  |  |  \- com.sun.jersey.contribs:jersey-guice:jar:1.9:compile
[INFO] |  |     |  |  |  \- org.apache.hadoop:hadoop-yarn-server-common:jar:2.2.0:compile
[INFO] |  |     |  |  \- org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.2.0:compile
[INFO] |  |     |  +- org.apache.hadoop:hadoop-yarn-api:jar:2.2.0:compile
[INFO] |  |     |  +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.2.0:compile
[INFO] |  |     |  |  \- org.apache.hadoop:hadoop-yarn-common:jar:2.2.0:compile
[INFO] |  |     |  \- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.2.0:compile
[INFO] |  |     +- org.apache.thrift:libthrift:jar:0.9.1:compile
[INFO] |  |     |  \- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |  |     \- org.apache.zookeeper:zookeeper:jar:3.4.5:compile
[INFO] |  |        \- org.jboss.netty:netty:jar:3.2.2.Final:compile
[INFO] |  +- org.openrdf.sesame:sesame-model:jar:2.7.6:compile
[INFO] |  |  \- org.openrdf.sesame:sesame-util:jar:2.7.6:compile
[INFO] |  \- org.json4s:json4s-ast_2.11:jar:3.2.10:compile
[INFO] +- com.ccri.crusher:crusher-web-cqlknn:jar:1.1.0-SNAPSHOT:compile
[INFO] |  +- com.ccri.crusher:crusher-suggest:jar:1.1.0-SNAPSHOT:compile
[INFO] |  |  +- com.ccri:knn-core:jar:2.1:compile
[INFO] |  |  |  +- com.ccri:knn-api:jar:2.1:compile
[INFO] |  |  |  +- com.ccri:knn-iterators:jar:2.1:compile
[INFO] |  |  |  +- com.ccri.commons:commons-serialization:jar:0.1.0:compile
[INFO] |  |  |  \- com.ccri.commons:commons-reflection-annotations:jar:0.1.10:compile
[INFO] |  |  \- org.scalanlp:breeze_2.11:jar:0.11:compile
[INFO] |  |     +- org.scalanlp:breeze-macros_2.11:jar:0.11:compile
[INFO] |  |     +- com.github.fommil.netlib:core:jar:1.1.2:compile
[INFO] |  |     +- net.sourceforge.f2j:arpack_combined_all:jar:0.1:compile
[INFO] |  |     +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] |  |     +- com.github.rwl:jtransforms:jar:2.4.0:compile
[INFO] |  |     |  \- junit:junit:jar:4.8.2:compile
[INFO] |  |     +- org.apache.commons:commons-math3:jar:3.2:compile
[INFO] |  |     \- org.spire-math:spire_2.11:jar:0.7.4:compile
[INFO] |  |        \- org.spire-math:spire-macros_2.11:jar:0.7.4:compile
[INFO] |  +- com.ccri.dragonfish:ccri-ontology:jar:1.7.1:compile
[INFO] |  +- com.ccri.dragonfish:dragonfish-accumulo-core:jar:1.7.1:compile
[INFO] |  +- com.ccri.dragonfish:dragonfish-geometry:jar:1.7.1:compile
[INFO] |  |  +- org.locationtech.geomesa:geomesa-utils:jar:1.2.0:compile
[INFO] |  |  |  +- commons-pool:commons-pool:jar:1.6:compile
[INFO] |  |  |  +- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] |  |  |  |  \- org.tukaani:xz:jar:1.0:compile
[INFO] |  |  |  +- com.vividsolutions:jts:jar:1.13:compile
[INFO] |  |  |  +- org.geotools:gt-referencing:jar:14.1:compile
[INFO] |  |  |  |  +- com.googlecode.efficient-java-matrix-library:core:jar:0.26:compile
[INFO] |  |  |  |  \- net.sf.geographiclib:GeographicLib-Java:jar:1.44:compile
[INFO] |  |  |  +- org.geotools:gt-main:jar:14.1:compile
[INFO] |  |  |  +- org.geotools:gt-Metadata:jar:14.1:compile
[INFO] |  |  |  +- org.geotools:gt-opengis:jar:14.1:compile
[INFO] |  |  |  |  \- net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2:compile
[INFO] |  |  |  +- org.geotools:gt-api:jar:14.1:compile
[INFO] |  |  |  +- org.geotools:gt-grid:jar:14.1:compile
[INFO] |  |  |  +- org.geotools:gt-data:jar:14.1:compile
[INFO] |  |  |  \- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] |  |  \- org.geotools:gt-shapefile:jar:14.2:compile
[INFO] |  |     +- org.jdom:jdom:jar:1.1.3:compile
[INFO] |  |     \- javax.media:jai_core:jar:1.1.3:compile
[INFO] |  +- com.ccri.dragonfish:dragonfish-imagery:jar:1.7.1:compile
[INFO] |  |  +- com.ccri.dragonfish:dragonfish-breeze:jar:1.7.1:compile
[INFO] |  |  +- com.ccri.dragonfish:dragonfish-serialization:jar:1.7.1:compile
[INFO] |  |  |  +- com.esotericsoftware.kryo:kryo:jar:2.21:compile
[INFO] |  |  |  |  +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:compile
[INFO] |  |  |  |  |  \- org.ow2.asm:asm:jar:4.0:compile
[INFO] |  |  |  |  +- com.esotericsoftware.minlog:minlog:jar:1.2:compile
[INFO] |  |  |  |  \- org.objenesis:objenesis:jar:1.2:compile
[INFO] |  |  |  \- com.twitter:chill_2.11:jar:0.5.0:compile
[INFO] |  |  |     \- com.twitter:chill-java:jar:0.5.0:compile
[INFO] |  |  +- com.ccri.opencv:opencv:jar:2.4.11-free-fix:compile
[INFO] |  |  \- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] |  \- com.ccri.dragonfish:dragonfish-native:jar:1.7.1:compile
[INFO] |     +- com.ccri.gdal:gdal-natives:jar:1.11.2:compile
[INFO] |     \- commons-io:commons-io:jar:2.4:compile
[INFO] +- com.ccri.crusher:crusher-web-enrich:jar:1.1.0-SNAPSHOT:compile
[INFO] |  +- com.ccri.crusher:crusher-enrich-core:jar:1.1.0-SNAPSHOT:compile
[INFO] |  \- com.typesafe:config:jar:1.2.1:compile
[INFO] +- com.ccri.crusher:crusher-enrich-imagechip:jar:1.1.0-SNAPSHOT:compile
[INFO] +- com.ccri.crusher:crusher-web-suggest:jar:1.1.0-SNAPSHOT:compile
[INFO] |  \- com.ccri.crusher:crusher-enrich-datetime:jar:1.1.0-SNAPSHOT:compile
[INFO] +- com.ccri.crusher:crusher-web-thumbnail:jar:1.1.0-SNAPSHOT:compile
[INFO] +- com.ccri.crusher:crusher-web-search:jar:1.1.0-SNAPSHOT:compile
[INFO] |  +- com.ccri.crusher:crusher-search:jar:1.1.0-SNAPSHOT:compile
[INFO] |  |  +- com.ccri.commons:commons-query-core:jar:0.0.1:compile
[INFO] |  |  \- org.apache.solr:solr-solrj:jar:4.10.2:compile
[INFO] |  |     +- org.apache.httpcomponents:httpclient:jar:4.3.1:compile
[INFO] |  |     +- org.apache.httpcomponents:httpcore:jar:4.3:compile
[INFO] |  |     +- org.apache.httpcomponents:httpmime:jar:4.3.1:compile
[INFO] |  |     +- org.codehaus.woodstox:wstx-asl:jar:3.2.7:compile
[INFO] |  |     \- org.noggit:noggit:jar:0.5:compile
[INFO] |  \- com.ccri.commons:commons-query-parsing:jar:0.0.1:compile
[INFO] +- com.ccri.crusher:crusher-web-slotfiller:jar:1.1.0-SNAPSHOT:compile
[INFO] |  \- com.ccri.crusher:crusher-slot-filler:jar:1.1.0-SNAPSHOT:compile
[INFO] |     +- com.ccri.commons:commons-reflection-loaders:jar:0.1.10:compile
[INFO] |     +- edu.stanford.nlp:stanford-corenlp:jar:3.5.2: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] |     |  +- de.jollyday:jollyday:jar:0.4.7:compile
[INFO] |     |  |  \- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] |     |  \- javax.json:javax.json-api:jar:1.0:compile
[INFO] |     +- edu.stanford.nlp:stanford-corenlp:jar:models:3.5.2:compile
[INFO] |     \- com.googlecode.efficient-java-matrix-library:ejml:jar:0.21:compile
[INFO] \- org.scala-lang:scala-library:jar:2.11.7:compile

解决方法:

我让自己引用java.io.Serializable的文档:

The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender’s class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:

ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;

If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on varIoUs aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class–serialVersionUID fields are not useful as inherited members. Array classes cannot declare an explicit serialVersionUID, so they always have the default computed value, but the requirement for matching serialVersionUID values is waived for array classes.

这里的问题是ejml库中的所有Seri​​alizable类都没有serialVersionUID字段.例如the SimpleBase class.
因此,在您的情况下发生的情况是,您有一个版本/版本的库序列化数据,但是由具有不同serialVersionUID的另一个版本/版本反序列化.

话虽这么说,您需要找出用于序列化数据的版本和构建,并仅使用该构建.如果它来自maven,那么你应该从maven中使用它.如果您自己编译该版本,则无法保证serialVersionUID将是相同的.

但是正确的修复是对ejml库的Pull Request,它将serialVersionUID值显式添加到实现Serializable的所有类中.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐