Search code examples
xpagesdomino-designer-eclipse

Cannot access Notes Application using NotesFactory


Up until recently I have been able to access my Notes Applications in Designer via Java and NotesFactory, both on copies on my local machine and on the server. I now have errors as follows in both scenarios. If I attempt to open the database with db.open() it is not successful, gets to 1% and fails. Other than the recent addition of ODA some weeks ago I cannot think of any reason why what has worked for a couple of years now fails.

Any help would be greatly appreciated.

Samples of errors using the two methods and associated arguments.

Session s = NotesFactory.createSessionWithFullAccess();

Exception in thread "main" NotesException: Database Ganymede!!NCLCMS.nsf has not been opened yet

Session s = NotesFactory.createSessionWithFullAccess("mypassword");

Exception in thread "main" NotesException: The ID file is locked by another process. Try again later

Session s = NotesFactory.createSession((String)null, (String)null, "mypassword");

Exception in thread "main" NotesException: The ID file is locked by another process. Try again later

Session s = NotesFactory.createSession()

Exception in thread "main" NotesException: Database Ganymede!!NCLCMS.nsf has not been opened yet

Session s = NotesFactory.createSession((String)null, (String)null,(String)null);

Exception in thread "main" NotesException: Database Ganymede!!NCLCMS.nsf has not been opened yet

As an example, the following worked fine until recently.

import lotus.domino.Database;
import lotus.domino.Document;
import lotus.domino.NotesException;
import lotus.domino.NotesFactory;
import lotus.domino.Session;
import lotus.domino.View;
import lotus.notes.NotesThread;

public class AssignItemParentType {

public static void main(String[] args) throws NotesException{
    assignItemParentType();
}

public static void assignItemParentType() throws NotesException{
    NotesThread.sinitThread();
    Session s = NotesFactory.createSessionWithFullAccess();

    Database db = s.getDatabase("Ganymede","NCLCMS.nsf");
    View itmView = db.getView("Itm Sales Order Form Internal");
    String parentID = null;
    String docType = null;
    Document parentDoc = null;
    Document itmDoc = itmView.getFirstDocument();
    Document oldDoc = null;
    int cnt=0;
    int x=0;
    while (itmDoc !=null){
        try{
        parentID = itmDoc.getItemValueString("ItmParentUID");
        parentDoc = db.getDocumentByUNID(parentID);
        docType = parentDoc.getItemValueString("Form");
        if (docType.equals("SOFInt")){
            cnt++;
            itmDoc.replaceItemValue("ItmParentType","Core");
            itmDoc.save();
        }
        parentDoc.recycle();
        }           
        catch (Exception e){System.out.println("Error with ID");
    }
        x++;
    oldDoc = itmView.getNextDocument(itmDoc);
    itmDoc.recycle();
    itmDoc = oldDoc;

    }
    itmView.recycle();
    db.recycle();

    System.out.println("Matches ="+cnt + " Records = "+x);

    NotesThread.stermThread();

}

Solution

  • Sorted with...

    Session s = NotesFactory.createSessionWithFullAccess("mypassword");
    

    If you attempt without the password (which previously worked) you have to restart Notes and Designer, then make the change. Probably obvious to some, as it is to me now some 4 hours later!