0
votes

When I run the following Java code on a Lotus Domino server, I get different results depending on where the code runs.

private void doViewStuff(Session session, PrintStream out) throws NotesException {
    Database db = session.getDatabase(null, "myDatabase.nsf");
    View view = db.getView("myViewName");

    Document doc = view.getFirstDocument();
    while (doc != null) {
        out.println("doc: " + doc.getUniversalID());
        doc = view.getNextDocument(doc);
    }

    ViewEntryCollection entries = view.getAllEntries();
    ViewEntry entry = entries.getFirstEntry();
    while (entry != null) {
        System.out.println("entry: " + entry.getColumnValues());
        entry = entries.getNextEntry(entry);
    }
}
  • When I run the code on the server as a Java agent, there are 37235 documents in the view.
  • When I run the code in a standalone client, there are only 37217 documents in the view, and the code is much, much slower.

Details and execution environment:

  • The server version is 8.5.3, the NCSO.jar I used for the client has SHA-1 d879f8992aae49a06769a564217633a9e0fbd1b6.
  • The database myDatabase.nsf contains about 150000 documents, each with a file attachment.
  • The missing documents do not appear in a block, they appear between index 10000 and 20000.
  • In both cases the code runs as the same user account.

What might be the reason that 18 of the documents cannot be found?


Update and Clarification

Upon further inspection, it turned out that I had indeed run the code with different user accounts, and that the inaccessible document had some Reader Names fields.

On the server I had this configuration, although I configured the agent to "Run on behalf of" CN=User Name/O=domain. It didn't matter whether I ran the agent from the Domino Console or via HTTP:

effectiveUserName=CN=User Name/O=domain
commonUserName=domino01
userName=CN=domino01/O=domain

On the client I had this configuration:

effectiveUserName=[NotesException: Not implemented]
commonUserName=User Name
userName=User Name/O=domain

And that was even though I used this code in the client:

Session session = NotesFactory.createSession("127.0.0.1", "User Name", "password");
1

1 Answers

1
votes

You say that in both cases the code runs as the same user account, so I want to trust that this is true. I presume, therefore, that you have ruled out Reader Names fields as cause of the discrepancy.

In that case, have you checked the IsValid() property of the ViewEntry objects when you process them in the agent running on the server? Perhaps the NCSO.jar implementation that you are using for the client-side code is filtering out the objects where IsValid() would return false.