【问题标题】:NoSuchMethodError using OWL API 4.0.xNoSuchMethodError 使用 OWL API 4.0.x
【发布时间】:2015-04-22 14:31:32
【问题描述】:

我下载了 OWL API(4.0.1 和 4.0.2)。但它需要大量没有提到的依赖项。我从 maven pom.xml 文件中下载了依赖项 JAR(在 OWL API 4.0.1 的某个地方找到了它)。罐子列表:

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

com.google.common.base.Objects.firstNonNull

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

com.google.common.base.Platform.systemNanoTime

stackoverflow 上的答案是:

您很可能同时拥有最新版本的 Guava 和 google-collect 或类路径上 3.0 之前的 Guava 版本

但不,我没有名为 google-collect(ions) 的旧 Guava 库。

【问题讨论】:

  • 你真的在使用 Maven 吗?
  • 不,我不知道。我找不到依赖项,所以我创建了 maven 项目并从 pom.xml 下载 JAR 并复制到我的项目(JavaFX)。
  • 直接依赖关系在这里:search.maven.org/… 如果你想要简单格式的间接依赖关系,请下载 owlapi-osgidistribution 并打开 jar。 lib 文件夹包含所需的依赖项。但我建议使用可以为您管理依赖项的构建工具,例如 maven 或 gradle。

标签: java guava guice owl-api


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    感谢您的回复。我用

    -verbose:class
    

    发现,那个类的包来自

    gephi-toolkit.jar
    

    Tt 也有 google-collection ...所以是的,不同的版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 2014-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多