import com.fourspaces.couchdb.Session;
import com.fourspaces.couchdb.Database;
import com.fourspaces.couchdb.Document;
import com.fourspaces.couchdb.View;
import com.fourspaces.couchdb.ViewResults;
import com.fourspaces.couchdb.CouchResponse;
import com.fourspaces.couchdb.AdHocView;
public class temporaryViews
{
public static void main(String[] args) throws Exception
{
Session s = new Session("localhost",5984,"monil","monil",false,false);
Database db = s.getDatabase("foodb");
// Running a view
ViewResults resultAdHoc = db.adhoc("function (doc) {emit(null, doc);}");
System.out.println(resultAdHoc.getResults().size());
}
}
我尝试使用上面的代码创建临时视图,我得到了
Exception in thread "main" java.lang.NullPointerException
at temporaryViews.main(temporaryViews.java:53)
请提出解决方案
提前致谢