NoSuchMethodError 使用 OWL API 4.0.x

NoSuchMethodError using OWL API 4.0.x

我下载了 OWL API(4.0.1 和 4.0.2)。但是它需要很多没有提到的依赖项。我从 Maven pom.xml 文件下载了依赖 JAR(在某处找到版本 OWL API 4.0.1)。罐子列表:

首先是RDF格式错误(需要添加芝麻库,pom.xml中没有。 但我仍然有“NoSuchMethodError”错误。 第一个是

com.google.common.base.Objects.firstNonNull

(使用 Guava 17.0)。我将其更新为 18.0,现在是

com.google.common.base.Platform.systemNanoTime

这里是 Whosebug 上的答案:

You most likely have both a recent version of Guava and either google-collect or a version of Guava prior to 3.0 on your classpath

但是不,我没有名为 google-collect(ions) 的旧番石榴库。

Maven 依赖项是可传递的。如果您出于某种原因不想使用 Maven,则需要包含所有这些。这是 owlapi 4.0.2 的依赖关系树。

[INFO] \- net.sourceforge.owlapi:owlapi-distribution:jar:4.0.2:compile
[INFO]    +- org.openrdf.sesame:sesame-model:jar:2.7.12:compile
[INFO]    |  \- org.openrdf.sesame:sesame-util:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-api:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-languages:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-datatypes:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-binary:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-n3:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-nquads:jar:2.7.12:compile
[INFO]    |  \- commons-io:commons-io:jar:2.4:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-ntriples:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-rdfjson:jar:2.7.12:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-core:jar:2.2.1:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-rdfxml:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-trix:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-turtle:jar:2.7.12:compile
[INFO]    +- org.openrdf.sesame:sesame-rio-trig:jar:2.7.12:compile
[INFO]    +- com.github.jsonld-java:jsonld-java-sesame:jar:0.5.0:compile
[INFO]    |  \- com.github.jsonld-java:jsonld-java:jar:0.5.0:compile
[INFO]    |     +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
[INFO]    |     |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO]    |     +- org.apache.httpcomponents:httpclient-cache:jar:4.2.5:compile
[INFO]    |     +- org.apache.httpcomponents:httpclient:jar:4.2.5:compile
[INFO]    |     |  +- org.apache.httpcomponents:httpcore:jar:4.2.4:compile
[INFO]    |     |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO]    |     \- org.slf4j:jcl-over-slf4j:jar:1.7.7:runtime
[INFO]    +- org.semarglproject:semargl-sesame:jar:0.6.1:compile
[INFO]    |  +- org.semarglproject:semargl-core:jar:0.6.1:compile
[INFO]    |  \- org.semarglproject:semargl-rdfa:jar:0.6.1:compile
[INFO]    |     \- org.semarglproject:semargl-rdf:jar:0.6.1:compile
[INFO]    +- com.google.guava:guava:jar:18.0:compile
[INFO]    +- com.google.inject:guice:jar:4.0-beta:compile
[INFO]    |  +- javax.inject:javax.inject:jar:1:compile
[INFO]    |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO]    +- com.google.inject.extensions:guice-multibindings:jar:4.0-beta:compile
[INFO]    +- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO]    +- org.apache.directory.studio:org.apache.commons.io:jar:2.4:compile
[INFO]    \- net.sf.trove4j:trove4j:jar:3.0.3:compile

在大多数情况下,使用 Maven(或其他一些现代构建工具)会让您的生活变得更加轻松。它处理这样的依赖性问题,因此您不必这样做。如果您出于某种原因坚持使用 ant,您还可以查看 ivy.

感谢您的回复。我用

-verbose:class

发现 class 的包裹来自

gephi-toolkit.jar

Tt 也有 google 系列……是的,不同的版本。