I'm writing a simple standalone Java class that uses Lotus Domino's NCSO JAR for remote-connecting to a Domino server.
I'm establishing a session, getting access to a database and then to a view:
Session session = NotesFactory.createSession("host", "user", "password");
Database db = session.getDatabase(null, "MyDB.nsf");
View view = db.getView("MyView");
Now, I'm printing the number of entries in the view:
int count = view.getEntryCount();
I get a nonzero number (let's say 1500).
However, I can't seem to load any document by key. For example, for any letter
in the alphabet, I'm getting an empty document collection with this call:
System.err.println(view.getAllDocumentsByKey(letter, false));
When I try to load a document by key, when I know that the key exists in the view, I get null
.
Document document = view.getDocumentByKey("DocKey"); // Equals null even though
// I know that 'DocKey' is
// the key of an existing
// document within the view.
The very same code is said to be working (although I didn't check it) when using local Notes calls (using Notes.jar
).
What am I missing?
EDIT
I just noticed that session.getNotesVersion()
returns version 8.5.2. The NCSO.jar
file that I'm currently using doesn't appear to have a few methods that were added with Notes 8. Therefore, there is a possibility that the NCSO.jar
file I use belongs to an earlier version of Notes than the one I'm trying to communicate with. Could that be the reason?
If the same code is working locally, then that should rule out the possibility that the first column of the view isn't sorted. Assuming that, then the most likely issue is that the documents are protected by ReaderNames fields and the identity that you are using for authenticating your session does not have access to the documents.