无法使用java notes api打开数据库 [英] Fail to open Database using java notes api

查看:111
本文介绍了无法使用java notes api打开数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用java程序在本地控制我的Lotus notes以自动发送电子邮件给我。尝试获取数据库对象时遇到以下问题。

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();
}

我得到以下例外:

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

我已将我的nsf文件和Notes.jar复制到我的classpath,谁知道这有什么问题?

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

推荐答案

要检查的几件事情。

第一次更改:

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")

到:

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

我还建议养成回收Domino对象的习惯。

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

这篇关于无法使用java notes api打开数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆