1

I am facing problem in getting started with casabah to integrate scala and mongoDb. I am using Spring Tool Suite(STS) and imported the following jar files :

spring-data-mongodb-1.6.0.RELEASE.jar

com.mongodb.jar

casbah-commons_2.10-2.7.2.jar

casbah-query_2.10-2.7.2.jar

joda-time-2.1.jar

slf4j-api-1.7.7.jar

casbah-gridfs_2.10-2.5.0.jar

scalaj-collection_2.10-1.4.jar

slf4j-simple-1.7.7.jar

casbah-core_2.10-2.7.2.jar

mongo-2.10.0.jar

mongo-java-driver-2.10.0.jar

However, I get an error.

Error:Description Resource Path Location Type bad symbolic reference. A signature in Implicits.class refers to type Cursor 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.

I read a couple of posts that says the problem is with the version in mongo-java-driver so i tried with mongo-java-driver-2.10.1.jar as well , But it was still giving me an error.

Could someone please help me resolve this error??

Thanks a lot in advance!!!

optimus
  • 77
  • 1
  • 6

1 Answers1

1

It looks like its a dependency issue. Casbah is built upon a fixed version of the Mongo Java driver so is reliant on a specific binary compatible version.

The Casbah version numbers should all be the same - above you mainly have Casbah 2.7.2 but the gridfs version is wrong: casbah-gridfs_2.10-2.5.0.jar.

Also, Casbah 2.7.2 relies on version 2.12.2 of the Mongo Java Driver, however, the latest version of Casbah is 2.7.3 which relies on version 2.12.3 of the Mongo Java Driver.

To make this simpler there is a all dependencies jar for Casbah that includes the latest version of the java driver and all the other relevant dependencies. Alternatively, the pom file should point all dependent packages which declare their dependencies. (As Casbah is split into sub packages the casbah-commons pom has all the external dependencies listed).

Ross
  • 17,861
  • 2
  • 55
  • 73