我正在使用MongoDB的Casbah驱动程序,当我编译我的项目时,它失败并出现以下错误:
[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依赖:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>casbah_2.10</artifactId>
<version>2.7.0-RC2</version>
</dependency>
为什么它会在编译期间失败?有什么线索可以寻找或改变什么?此外,我还看到以下警告:
[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,这是我在类路径中看到的:
[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依赖项!这很令人困惑。
答案 0 :(得分:0)
我弄清楚问题是什么。我对salat框架有一个额外的依赖,我不会在评估过程中添加使用nut。它实际上是将这些额外的jar文件放入类路径中,这实际上似乎是导致此错误的原因!