java.lang.IllegalArgumentException: state should be: w >= 0

843 views
Skip to first unread message

Geoffrey Knauth

unread,
Jul 27, 2015, 4:23:43 PM7/27/15
to mongodb-casbah-users
I'm fairly new to Casbah.  I'm using:

libraryDependencies += "org.mongodb" % "casbah_2.11" % "2.8.2"

libraryDependencies += "org.mongodb" % "mongo-java-driver" % "3.0.3"

This line in my code:

val mongoClient = MongoClient(uri)

causes:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.mongodb.casbah.BaseImports$class.$init$(Implicits.scala:162)
	at com.mongodb.casbah.Imports$.<init>(Implicits.scala:142)
	at com.mongodb.casbah.Imports$.<clinit>(Implicits.scala)
        at myprogram.Main$.setupMongoOutput(Main.scala:34)
        ...
Caused by: java.lang.IllegalArgumentException: state should be: w >= 0
	at com.mongodb.assertions.Assertions.isTrueArgument(Assertions.java:99)
	at com.mongodb.WriteConcern.<init>(WriteConcern.java:253)
	at com.mongodb.WriteConcern.<init>(WriteConcern.java:231)
	at com.mongodb.WriteConcern.<init>(WriteConcern.java:182)
	at com.mongodb.casbah.WriteConcern$.<init>(WriteConcern.scala:41)
	at com.mongodb.casbah.WriteConcern$.<clinit>(WriteConcern.scala)

What I am doing wrong?  I get this error even for a simple:  val mongoClient = MongoClient()

Thanks,
Geoff

Ross Lawley

unread,
Jul 28, 2015, 4:02:27 AM7/28/15
to mongodb-ca...@googlegroups.com
Hi Geoff,

Casbah currently relies on the 2.13.x version of the mongo java driver and is not compatible with 3.0.x

All its dependencies are listed in the pom.xml so just adding Casbah should suffice:

libraryDependencies += "org.mongodb" % "casbah_2.11" % "2.8.2"
Ross

--
You received this message because you are subscribed to the Google Groups "mongodb-casbah-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-casbah-u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

name     : "Ross  Lawley",

  title    : "JVM Software Engineer",

  location : "London, UK",

  twitter  : ["@RossC0", "@MongoDB""@MongoDBInc"],

  facebook : ["MongoDB", "MongoDB, Inc."] }

Reply all
Reply to author
Forward
0 new messages