thanx for your response stawicki.. I tried removign common-httpclient-3.1 but i get another error:
java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity Any clues? ________________________________________ From: Paweł Stawicki [[email protected]] Sent: Tuesday, June 29, 2010 12:20 PM To: [email protected] Subject: Re: couchdb from java. This error is caused because both httpclient-4.0-bet2 and commons-httpclient-3.1 are on your classpath. Choose one version of httpclient. regards -- Paweł Stawicki http://pawelstawicki.blogspot.com http://szczecin.jug.pl On Mon, Jun 28, 2010 at 15:20, 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? > > > > 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). > ________________________________ 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).
