No bucket named ,but the name appears in webpage

Hi, I have a a very strange problem when using N1QL and CBQ to retrieve the documents in a couchbase. I suspect it is wrong configuration of this database. I will call this couchbase base as A.

I have an other couchbase B which can perform well, but the same procedure and code got different one couchbase A.

Response From the Server
"code": 12003,
“msg”: “Keyspace not found keyspace XXXX - cause: No bucket named XXXX”

The bucket with the name XXXX can actually be seen from the web portal.

Details of my environment
JAVA JDK 1.7
JAVA SDK 2.1.4,
Couchbase Server Version: 4.0.0-4047:

I CAN

  1. open a bucket and use bucket.get() to get the document.
  2. login the web portal and see the bucket and documents in the bucket.

However, I CAN NOT

  1. use cbq to create index on the bucket. Such a bucket is shown in the web portal , but when use cbq the console tells me that
    "errors": [
    {
    “code”: 12003,
    “msg”: “Keyspace not found keyspace XXXX - cause: No bucket named XXXX”
    }
    ],

  2. use JAVA JDK to retrieve documents fails and get the same message

My code and N1QL when retrieving the documents

java code

		this.openConnection();
		
		this.bucket1 = couchBaseConnector.getBucket("XXXX");
		
		def arrayOfChartFlowInstances = [];
		
		JsonDocument archiveInstance = bucket1.get( "InstArchID:2016-0310-1217-0032-1457576253083" ); // this one works
		
                   ArrayList<String> statements = new ArrayList<String>()
                  /*
                   create two N1QL statements
                  */

		QueryResult queryResult = bucket1.query( statements.get(0) );
				
		Iterator<QueryRow> rows = queryResult.rows();
		
		while( rows.hasNext() ){				
			def archiveInstanceContent = new JSONObject( rows.next().toString() );
			arrayOfChartFlowInstances.push( archiveInstanceContent );			
		}

		queryResult = bucket1.query( statements.get(1) );

N1QL

SELECT * FROM XXXX WHERE caseInfo.createDate.numeric <= 20160330 AND caseInfo.createDate.numeric >= 20160301 AND facilityInformation.facilityID = “9” ORDER BY caseInfo.createDate.numeric DESC LIMIT 40 OFFSET 0;

SELECT count(*) FROM XXXX WHERE caseInfo.createDate.numeric <= 20160330 AND caseInfo.createDate.numeric >= 20160301 AND facilityInformation.facilityID = “9”

As a starting point, on the offending node, what does select * from system:keyspaces; return?