【问题标题】:Casbah missing reference error for "MongoCursor" using EclipseCasbah 使用 Eclipse 缺少“MongoCursor”的参考错误
【发布时间】:2014-03-10 18:11:22
【问题描述】:

每当我为 MongoDB 使用 Scala 库时,我都会遇到此错误。

bad symbolic reference. A signature in Implicits.class refers to type MongoCursor in 
package com.mongodb which is not available. It may be completely missing from the 
current classpath, or the version on the classpath might be incompatible with the 
version used when compiling Implicits.class.  

我在响应以下行时收到错误:
val client = MongoClient("localhost", 27017)

我尝试了各种 jar 文件的不同版本,但没有修复它。我一直在使用最新的版本,所以我不知道问题是什么。它不会给我行引用,而且我在 Implicits.class 源中找不到对“MongoCursor”类型的引用。我觉得我错过了另一个图书馆,但我不知道它会是什么。

我正在使用:
joda-time-2.3.jar
mongo-java-driver-2.11.4.jar
casbah_2.10-2.7.0-SNAPSHOT.jar
casbah-commons_2.10-2.7.0-SNAPSHOT.jar
casbah-core_2.10-2.7.0-SNAPSHOT.jar
casbah-gridfs_2.10-2.7.0-SNAPSHOT.jar
casbah-query_2.10-2.7.0-SNAPSHOT.jar

【问题讨论】:

  • 类路径中缺少 jar,或者您使用了错误的版本组合。最简单的方法是使用 Sbt 拉取你的依赖项,并使用 sbteclipse 生成一个 Eclipse 项目。

标签: eclipse mongodb scala casbah


【解决方案1】:

您需要更新 Java 驱动程序,因为 2.7.0-SNAPSHOT 依赖于 mongo-java-driver 2.12.0-SNAPSHOT - 然后它应该能够正确找到 MongoCursor。

【讨论】:

  • 没有可用的“SNAPSHOT”jar,只有“mongo-java-driver-2.12.0-rc0”。那并没有解决问题。我还从 mongo-java-driver repo 制作了一个 jar,它也没有解决问题。我仍然得到同样的错误。这让我有点发疯。
  • 可以在 sonatype snapshots repo 中找到快照,但是现在应该可以发现 2.7.0-RC2。
  • 谢谢。将 casbah-core 更新到 RC2 修复了它。
猜你喜欢
  • 2011-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-21
  • 2018-11-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多