On notes side, I created a local nsf called localNSF.nsf. Then I wrote code try to access this nsf. I do not have Domino started, and nsf is only in the …/Lotus/Notes/data folder. The code are as follow:
[code]-------------------------------------------------------
lotus.notes.NotesThread.sinitThread();
lotus.domino.Session localSession = null;
try {// ------------- try to get a local session
localSession = NotesFactory.createSession();
} catch (NotesException e) {
e.printStackTrace();
}
if(localSession == null){
System.out.println("failed to get local session.");
}else{
System.out.println("got local session.");
}
//----------- register the id file
String idfile = "D:\\Program Files\\Lotus\\Notes\\data\\user.id";
Registration r;
try {
r = localSession.createRegistration();
r.switchToID(idfile, password);
} catch (NotesException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//------------- try to get database
lotus.domino.Database db = null;
try {
db = localSession.getDatabase("","localNSF");
} catch (NotesException e) {
e.printStackTrace();
}
if(db == null){
System.out.println("failed to get local db.");
}else{
System.out.println("got local db.");
}
try {
System.out.println("db title = " + db.getLastModified());
} catch (NotesException e) {
e.printStackTrace();
}
lotus.notes.NotesThread.stermThread();
[/code]-------------------------------------------------
before execute the code above, I include the location of notes.jar, ncso.jar and nlsxbe.dll in the PATH.
then when executing the code, I could getSession() ‘successfully’, I mean the ‘localSession’ is not null; then I could get database, it mean ‘db’ is not null; but when doing ‘db.getLastModified()’ call, I caught the following error:
[error] -----------------------------------------------
NotesException: Database localNSF.nsf has not been opened yet
at lotus.domino.local.NotesBase.PropGetDate(Native Method)
at lotus.domino.local.Database.getLastModified(Unknown Source)
at LocalSessionTry.main(LocalSessionTry.java:62)
[/error] -----------------------------------------------
Could anybody shed light on this?