I don't think you should have both commons-httpclient-3.1.jar and httpclient-4.0.-bet2.jar on the classpath. Since I'm not a couchdb4j user a cannot tell you which one is right, but since couchdb4j doesn't seem to be that actively developed I would guess commons-httpclient-3.1.jar is the one to have.
If your problems persist I suggest that you take a look at Ektorp: http://code.google.com/p/ektorp/ It is actively developed and is distributed as a Maven bundle so you don't have to manage the dependencies yourself. Disclosure: I am the developer of Ektorp regards Henrik On Mon, Jun 28, 2010 at 3:30 PM, Jyoti Venkatesh <[email protected]> wrote: > Have a problem with couchdb. I have installed couchdb and hv written code to > insert document from java. > Following is my code: > Session dbSession = new Session("localhost", 5984); > dbSession.createDatabase("employee"); > Database db = dbSession.getDatabase("employee"); > System.out.println("Database name is --"+db.toString()); > > Document doc = new Document(); > doc.setId("1"); > doc.put("EmpNo", 1); > doc.put("Name", "Mike"); > doc.put("Group", "J2EECOE"); > doc.put("Designation", "Manager"); > doc.put("Language","Java"); > db.saveDocument(doc); > > but i am getting the following exceptions: > > Exception in thread "main" java.lang.NoSuchMethodError: > org.apache.commons.httpclient.HeaderElement.parseElements(Ljava/lang/String;)[Lorg/apache/commons/httpclient/HeaderElement; > at > org.apache.commons.httpclient.methods.StringRequestEntity.<init>(StringRequestEntity.java:101) > at com.fourspaces.couchdb.Session.post(Session.java:276) > at com.fourspaces.couchdb.Session.post(Session.java:262) > at com.fourspaces.couchdb.Database.saveDocument(Database.java:169) > at com.fourspaces.couchdb.Database.saveDocument(Database.java:194) > at testForCouchDB.CouchDBTest.main(CouchDBTest.java:28) > > I have the following jars in the classpath: > cayenne-1.2.1.jar > commons-beanutils-1.8.3.jar > commons-codec-1.3.jar > commons-httpclient-3.1.jar > commons-logging-1.1.1.jar > couchdb4j-0.1.2.jar > ezmorph-1.0.6.jar > httpclient-4.0.-bet2.jar > httpcore-4.0.1.jar > httpmime-4.0.1.jar > json-lib-2.2.3-jdk15.jar > > > please let me know what is it that i am missing? from futon when i run the > test suite i get errors in few... > what is the cause.. > > thanx > jyoti > > DISCLAIMER > > The content of this email and any attachments ('email') is confidential, may > be privileged, subject to copyright and may be read and used only by the > intended recipient. If you are not the intended recipient please notify us by > return email or telephone and erase all copies and do not disclose the email > or any part of it to any person. Email transmission cannot be guaranteed to > be secure, or error free as information could be intercepted, corrupted, lost > or destroyed as a result of the transmission process. The sender, therefore, > does not accept liability for any errors, omissions, viruses or delay in > transmission as a result of this mail. We monitor email communications > through our networks for regulatory compliance purposes and to protect our > clients, employees and business. Opinions, conclusions, and other information > in this message that do not relate to the official business of NIIT > Technologies Ltd. or its affiliate(s) shall be understood to be neither given > nor endorsed by NIIT Technologies Ltd. or its affiliate(s). >
