首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Casbah MongoDB驱动程序编译器错误

Casbah MongoDB驱动程序编译器错误
EN

Stack Overflow用户
提问于 2014-03-15 17:13:27
回答 1查看 248关注 0票数 0

我正在为MongoDB使用Casbah驱动程序,当我编译我的项目时,它失败了,出现了以下错误:

代码语言:javascript
复制
[INFO] Compiling 12 source files to /core/target/classes at 1394903201140
[ERROR] error: bad symbolic reference. A signature in MongoClient.class refers to type MongoClientURI
[INFO] in package com.mongodb which is not available.
[INFO] It may be completely missing from the current classpath, or the version on
[INFO] the classpath might be incompatible with the version used when compiling MongoClient.class.
[ERROR] error: bad symbolic reference. A signature in MongoClient.class refers to type MongoClient
[INFO] in package com.mongodb which is not available.
[INFO] It may be completely missing from the current classpath, or the version on
[INFO] the classpath might be incompatible with the version used when compiling MongoClient.class.
[ERROR] two errors found

我的maven依赖项设置如下:

代码语言:javascript
复制
<dependency>
  <groupId>org.mongodb</groupId>
  <artifactId>casbah_2.10</artifactId>
  <version>2.7.0-RC2</version>
</dependency>

为什么现在在编译过程中失败了?有什么线索要找什么或者要改什么?此外,我还看到以下警告:

代码语言:javascript
复制
[WARNING]  Expected all dependencies to require Scala version: 2.10.3
[WARNING]  org.mongodb:casbah_2.10:2.7.0-RC2 requires scala version: 2.10.3
[WARNING]  org.mongodb:casbah-commons_2.10:2.7.0-RC2 requires scala version: 2.10.3
[WARNING]  com.github.nscala-time:nscala-time_2.10:0.6.0 requires scala version: 2.10.2

这和编译失败有什么关系吗?此外,我在调试模式下运行了maven,这就是我在类路径中看到的:

代码语言:javascript
复制
[DEBUG] Classpath: [/../../target/classes
 /Softwares/maven-repo/org/scala-lang/scala-library/2.10.3/scala-library-2.10.3.jar
 /Softwares/maven-repo/org/mongodb/casbah-commons_2.10/2.7.0-RC2/casbah-commons_2.10-2.7.0-RC2.jar
 /Softwares/maven-repo/com/github/nscala-time/nscala-time_2.10/0.6.0/nscala-time_2.10-0.6.0.jar
 /Softwares/maven-repo/org/joda/joda-convert/1.2/joda-convert-1.2.jar
 /Softwares/maven-repo/org/slf4j/slf4j-api/1.6.0/slf4j-api-1.6.0.jar
 /Softwares/maven-repo/org/mongodb/casbah-core_2.10/2.7.0-RC2/casbah-core_2.10-2.7.0-RC2.jar
 /Softwares/maven-repo/org/mongodb/casbah-query_2.10/2.7.0-RC2/casbah-query_2.10-2.7.0-RC2.jar
 /Softwares/maven-repo/org/mongodb/casbah-gridfs_2.10/2.7.0-RC2/casbah-gridfs_2.10-2.7.0-RC2.jar
 /Softwares/maven-repo/com/novus/salat-core_2.9.2/0.0.8/salat-core_2.9.2-0.0.8.jar
 /Softwares/maven-repo/com/novus/salat-util_2.9.2/0.0.8/salat-util_2.9.2-0.0.8.jar
 /Softwares/maven-repo/org/scala-lang/scalap/2.9.2/scalap-2.9.2.jar
 /Softwares/maven-repo/org/scala-lang/scala-compiler/2.9.2/scala-compiler-2.9.2.jar
 /Softwares/maven-repo/org/mongodb/mongo-java-driver/2.7.3/mongo-java-driver-2.7.3.jar
 /Softwares/maven-repo/com/mongodb/casbah/casbah-core_2.9.1/2.1.5-1/casbah-core_2.9.1-2.1.5-1.jar
 /Softwares/maven-repo/com/mongodb/casbah/casbah-commons_2.9.1/2.1.5-1/casbah-commons_2.9.1-2.1.5-1.jar
 /Softwares/maven-repo/org/scala-tools/time/time_2.9.1/0.5/time_2.9.1-0.5.jar
 /Softwares/maven-repo/org/scalaj/scalaj-collection_2.9.1/1.2/scalaj-collection_2.9.1-1.2.jar
 /Softwares/maven-repo/com/mongodb/casbah/casbah-query_2.9.1/2.1.5-1/casbah-query_2.9.1-2.1.5-1.jar
 /Softwares/maven-repo/net/liftweb/lift-json_2.9.1/2.4/lift-json_2.9.1-2.4.jar
 /Softwares/maven-repo/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar
 /Softwares/maven-repo/com/typesafe/config/1.0.2/config-1.0.2.jar
 /Softwares/maven-repo/joda-time/joda-time/2.3/joda-time-2.3.jar]

我不明白其他依赖项(尤其是casbah-core_2.9.1、casbah-query_2.9.1 )是从哪里来的?我没有将它们作为我的pom.xml中的maven依赖项!令人费解。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-15 20:43:02

我知道问题出在哪里了。我对salat框架有一个额外的依赖,我在评估期间不使用螺母。它实际上是把这些额外的jar文件拉到类路径中,这似乎是导致这个错误的原因!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22427055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档