从Tomcat 7到Domino 9进行本地调用

时间:2014-11-30 14:53:49

标签: java tomcat lotus-domino

我已经试着整天解决这个问题,但还没有找到解决方案。

我想在Tomcat 7上运行一个Web应用程序,该应用程序在同一台机器上对Domino 9 Server进行本地调用。

我的出发点是:http://www-10.lotus.com/ldd/dominowiki.nsf/dx/DIIOP_Usage_and_Troubleshooting_Guide以及它链接到的其他文章。

服务器将Ubuntu 14.04作为操作系统 我已经通过更改 / etc / default / tomcat7

解决了所有绑定错误
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.library.path=/opt/ibm/lotus/notes/latest/linux"

#NOTES_DATA_DIR=/srvmuc202_data
PATH=$PATH:/opt/ibm/lotus/notes/latest/linux:/srvmuc202_data
LD_LIBRARY_PATH=/opt/ibm/lotus/notes/latest/linux
#CLASSPATH=$CLASSPATH:/opt/ibm/lotus/notes/latest/linux/jvm/lib/ext/Notes.jar

notes.ini位于数据目录中。我发现访问它的唯一方法是将其添加到路径中。

我无法正确更改CLASSPATH。这就是它评论的原因。如果激活,Tomcat将忽略此设置 编辑: 我通过将Notes.jar添加到我的WAR文件中解决了它。
我现在使用已安装的Notes.jar。它的工作原理是因为我在Tomcat lib目录/usr/share/tomcat7/lib

中为Notes.jar创建了一个符号链接

这是我的测试代码:

NotesThread.sinitThread();
Session session = null;
Database db = null;
try {
    session = NotesFactory.createSession();
    if (session != null) {
        log.debug("Session available");
        log.debug("Servername: {}", session.getServerName());
        log.debug("Effective user name: {}", session.getEffectiveUserName());
        log.debug("User name: {}", session.getUserName());
        log.debug("Common user name: {}", session.getCommonUserName());
        log.debug("Notes version: {}", session.getNotesVersion());
        db = session.getDatabase("", "mbur/mburchard.nsf", false);
        if (db != null && db.isOpen()) {
            log.debug("Got database: {}", db.getTitle());
        }
    }
} catch (NotesException e) {
    log.error("", e);
} finally {
    recycle(db);
    recycle(session);
}
NotesThread.stermThread();

不将数据目录添加到我的应用程序工作的路径,但无法访问任何内容。然后输出:

[23606:00002-965273344] Error writing to process file pid.nbf, (other applications may be inappropriately accessing this file)
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - Session available
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - Servername: 
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - Effective user name: 
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - User name: 
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - Common user name: 
15:43:45.859 [http-bio-7080-exec-1] DEBUG de.mbur.billing.impl.TestNotes - Notes version: Release 9.0.1FP2HF385 | November 4, 2014

我认为,这是因为它不知道notes.ini和Domino服务器id文件。

修改
我将Tomcat添加到Domino Servers组,现在错误的258已经消失了 现在它的行为与不知道notes.ini的行为相同 没有有效的用户名,无法访问任何内容。

使用路径中的数据目录,我收到一条错误消息:

15:48:22.650 [http-bio-7080-exec-1] ERROR d.mbur.billing.impl.PersonController - 
java.lang.Exception: Notes initialization failure - err 258
    at lotus.domino.NotesThread.NnotesInitThread(Native Method) ~[Notes.jar:na]
    at lotus.domino.NotesThread.sinitThread(Unknown Source) ~[Notes.jar:na]
    at de.mbur.billing.impl.TestNotes.run(TestNotes.java:18) ~[TestNotes.class:na]
    at de.mbur.billing.impl.PersonController.greeting(PersonController.java:49) ~[PersonController.class:na]

我感谢任何帮助以正确的方式从Tomcat 7访问Domino 9。 理想情况下,不要将Notes.jar添加到WAR文件中,并以完整的服务器权限运行。

1 个答案:

答案 0 :(得分:1)

休息一下后,我有时间测试并解决这个问题。

这是一个非常小的细节。 Domino组的写权限!

我想把这个答案作为编写完整指南的机会。

如何在同一台计算机上从Tomcat访问Domino

Tomcat(或运行Java代码的任何其他程序)应位于Domino组中,通常名为 notes
确保此Domino组已读取Notes数据目录中所有内容的和写入权限。

更改Tomcat配置(在 / etc / default / tomcat7 下可用的Ubuntu 14.04下)

JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.library.path=/opt/ibm/domino/notes/latest/linux"

PATH=$PATH:/opt/ibm/lotus/notes/latest/linux:/local/notesdata
LD_LIBRARY_PATH=/opt/ibm/domino/notes/latest/linux

通过切换到目录 / usr / share / tomcat7 / lib 并创建符号链接来链接到Notes.jar。

sudo ln -s /opt/ibm/domino/notes/latest/linux/jvm/lib/ext/Notes.jar

将WAR文件部署到Tomcat并开心:)