Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fail to open Database using java notes api

I am trying to use a java program to control my lotus notes locally to send email automatically for me. I have encountered the following issues when trying to get a database object.

try {
    NotesThread.sinitThread();
    Session s = NotesFactory.createSession();
    Database db = s.getDatabase("", "mail/xxxx.nsf")
} finally {
    NotesThread.stermThread();
}

I got the following Exception:

NotesException: Database open failed (%1)
   at lotus.domino.local.Database.Nopen(Native Method)
   at lotus.domino.local.Database.open(Unknown Source)

I have copy my nsf file and Notes.jar to my classpath, anyone knows what is the problem with this?

like image 934
user1758952 Avatar asked Dec 04 '25 15:12

user1758952


1 Answers

A couple of things to check.

First change:

Session s = NotesFactory.createSession();

to:

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

If it is still not working then change:

Database db = s.getDatabase("", "mail/xxxx.nsf")

to:

Database db = s.getDatabase((String) null, "mail/xxxx.nsf")

I would also recommend to getting into the habit of recycling your Domino objects.

like image 58
Simon O'Doherty Avatar answered Dec 07 '25 03:12

Simon O'Doherty