Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

java.lang.NoSuchMethodError: com.mongodb.DBCollection.save(Lcom/mongodb/DBObject;)V

Here is the sample code. Error is on Line 3.

1   BasicDBObject dbo=new BasicDBObject(data);
2   DBCollection coll = new Mongo().getDB("test")
3   coll.save(dbo);
4   data.put(Entity.DB_ID, dbo.get(Entity.DB_ID));

Strangely, this error is showing when running as webapp from Tomcat6 and using mongo 2.4 or 2.5.3. With 2.0.rc3, it works fine. I want to use 2.5.3 Also, when runing from eclipse, or commandline, it works with all the three versions(2.0 ,2.4, 2.5.3) And the DBCollection class is being loaded because coll.insert(), coll.find() are working. Just that it is saying NoSuchMethodError when I call save().

This is a fresh install of Ubuntu 10.4 and tomcat6 on top of it. The JDK is OpenJDK java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)

share|improve this question

1 Answer 1

Sounds like you need to recompile here and make sure you targets are clean, if there were conlicting mongo jar files from different versions in the class path then a change in the moethod return (which I think there is in 2.0 --> 2.5) would cause this kind of problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.