mbreese / couchdb4j Goto Github PK
View Code? Open in Web Editor NEWCouchDB library for Java using JSON
License: Apache License 2.0
CouchDB library for Java using JSON
License: Apache License 2.0
Trying to get a view document
E.g.
Document viewDoc = db.getDocument("_design/Generated Content");
Complains about invalid URL
http://localhost:5984/test/_design/Generated Content/_view/all
(note the space)
Replacing the space with %20 does not help either. In that case it doesn't find the document. CouchDB (Futon) works just fine.
Publish jar on http://mvnrepository.com/ or other Maven repository.
Adding a new view from code gives the following error with the older library. It works fine with 2.4 (json-lib).
Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: Property 'text' has no getter method
at net.sf.json.JSONObject._fromBean(JSONObject.java:958)
at net.sf.json.JSONObject.fromObject(JSONObject.java:193)
at net.sf.json.JSONObject._processValue(JSONObject.java:2778)
at net.sf.json.JSONObject.processValue(JSONObject.java:2837)
at net.sf.json.JSONObject.setInternal(JSONObject.java:2852)
at net.sf.json.JSONObject._accumulate(JSONObject.java:2725)
at net.sf.json.JSONObject.accumulate(JSONObject.java:1631)
at com.fourspaces.couchdb.Document.addView(Document.java:198)
at couch.Main.createViewGetSession(Main.java:37)
at couch.Main.main(Main.java:23)
Caused by: java.lang.NoSuchMethodException: Property 'text' has no getter method
at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1127)
at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
at net.sf.json.JSONObject._fromBean(JSONObject.java:930)
... 9 more
Sample Code:
Document doc = new Document();
doc.addView("checkexist", "getSessions", "function(doc) {\n emit(doc.sessionID, doc); \n}");
db.saveDocument(doc);
Not sure if this is by design, but Session.http() is returning the lastResponse when it times out (IOException) on a equest to the couch server. This results in the failed Database.view() call quietly returning the results of the last view, and we return invalid data to our users.
The time out is logged, but we would prefer a noisy failure (maybe even a checked exception!) so we can take steps to handle it.
Regards............ Larry
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.