DbAccessException in Couchdb on android

30 views
Skip to first unread message

PRASASNNA KUMAR

unread,
Jan 20, 2014, 10:26:13 AM1/20/14
to mobile-c...@googlegroups.com
Hello,

               While running the Couchdb Android application am getting error like below

01-20 10:15:06.311    3941-3941/com.couchbase.grocerysync E/ouchbaseViewListAdapter﹕ DbAccessException accessing view for list
    org.ektorp.DocumentNotFoundException: nothing found on db path: cblite:///android_testdb/ed/_view/projectdoc?update_seq=true, Response body: null
            at org.ektorp.http.StdResponseHandler.createDbAccessException(StdResponseHandler.java:34)
            at org.ektorp.http.StdResponseHandler.error(StdResponseHandler.java:62)
            at org.ektorp.http.RestTemplate.handleResponse(RestTemplate.java:107)
            at org.ektorp.http.RestTemplate.getUncached(RestTemplate.java:27)
            at org.ektorp.impl.StdCouchDbConnector.executeQuery(StdCouchDbConnector.java:410)
            at org.ektorp.impl.StdCouchDbConnector.queryView(StdCouchDbConnector.java:449)
            at org.ektorp.android.util.CouchbaseViewListAdapter$1.doInBackground(CouchbaseViewListAdapter.java:91)
            at org.ektorp.android.util.EktorpAsyncTask.doInBackground(EktorpAsyncTask.java:29)
            at org.ektorp.android.util.EktorpAsyncTask.doInBackground(EktorpAsyncTask.java:21)
            at android.os.AsyncTask$2.call(AsyncTask.java:287)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)

Where I have Writen views also like

 protected static void startCBLite(String DATABASE_NAME) {
        //static inializer to ensure that touchdb:// URLs are handled properly
        {
            CBLURLStreamHandlerFactory.registerSelfIgnoreError();
        }

        try {
            server = new CBLServer(filesDirc);
        } catch (IOException e) {
            Log.e(TAG, "Error starting TDServer", e);
        }

        //install a view definition needed by the application
        CBLDatabase db = server.getDatabaseNamed(DATABASE_NAME);
        Log.v("DataBase Name",""+server.getDatabaseNamed(DATABASE_NAME));
        CBLView view = db.getViewNamed(String.format("%s/%s", Constants.dDocName, Constants.BYDATEVIEWNAME));
        view.setMapReduceBlocks(new CBLViewMapBlock() {

            @Override
            public void map(Map<String, Object> document, CBLViewMapEmitBlock emitter) {
                Object type = document.get("_id");
                try{
                    if(type != null && type.equals("connections") )
                    {
                        Log.v("Inside The View",""+type.toString());
                        emitter.emit(document.get("_id"), document);
                    }
                }catch (NullPointerException e){}
            }
        }, null, "1.12");
}
}

My View Query is

   
protected static void startEktorp() {
        System.out.println(DATABASE_NAME);
        //static inializer to ensure that touchdb:// URLs are handled properly
        {
            CBLURLStreamHandlerFactory.registerSelfIgnoreError();
        }
        if(httpClient != null) {
            httpClient.shutdown();
        }

        httpClient = new CBLiteHttpClient(server);
        dbInstance = new StdCouchDbInstance(httpClient);

        GrocerySyncEktorpAsyncTask startupTask = new GrocerySyncEktorpAsyncTask() {

            @Override
            protected void doInBackground() {

                couchDbConnector = dbInstance.createConnector(DATABASE_NAME, true);
                Log.v("Database Name In Ektorp ",""+couchDbConnector.getDatabaseName());
            }

            @Override
            protected void onSuccess() {
                //attach list adapter to the list and handle clicks
                System.out.println("8");

                ViewQuery viewQuery = new ViewQuery().designDocId(Constants.dDocName).viewName(Constants.BYDATEVIEWNAME);
                itemListViewAdapter = new GrocerySyncListAdapter(ctx, couchDbConnector, viewQuery);
                itemListView.setAdapter(itemListViewAdapter);

          

                startReplications();

            }
        };
        startupTask.execute();
    }

Replication Method is :

public static void startReplications() {
        //static inializer to ensure that touchdb:// URLs are handled properly
        {
            CBLURLStreamHandlerFactory.registerSelfIgnoreError();
        }

        Log.v("Database Names are In Replications",""+DATABASE_NAME);
        pushReplicationCommand = new ReplicationCommand.Builder()
                .source(DATABASE_NAME)
                .target(source)
                .continuous(true)
                .build();

        GrocerySyncEktorpAsyncTask pushReplication = new GrocerySyncEktorpAsyncTask() {

            @Override
            protected void doInBackground() {
                dbInstance.replicate(pushReplicationCommand);
            }
        };

        pushReplication.execute();

        pullReplicationCommand = new ReplicationCommand.Builder()
                .source(source)
                .target(DATABASE_NAME)
                .continuous(true)
                .build();

        GrocerySyncEktorpAsyncTask pullReplication = new GrocerySyncEktorpAsyncTask() {

            @Override
            protected void doInBackground() {
                dbInstance.replicate(pullReplicationCommand);
                Log.v("Database Names are In Replications","pulling replication also working sucessfully");

            }
        };

        pullReplication.execute();
    }

In GrocerySyncListAdapter class i did what are methods we need follow.
Pls help me

Thank you

Traun Leyden

unread,
Jan 20, 2014, 1:30:51 PM1/20/14
to mobile-c...@googlegroups.com
Which branch/commit/version of GrocerySync are you using? 



--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/4983fe0f-01a0-4047-ba35-0c29d6882c8b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages