Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 列出所有LotusNotes数据库_Java_Lotus Notes_Lotus Domino - Fatal编程技术网

Java 列出所有LotusNotes数据库

Java 列出所有LotusNotes数据库,java,lotus-notes,lotus-domino,Java,Lotus Notes,Lotus Domino,我尝试使用Java创建LotusNotes客户机。现在,我在列出所有用户定义的数据库时遇到了一个问题。我想做的是 // testing purpose private void printAllDb() throws NotesException { DbDirectory dir = session.getDbDirectory(host); String server = dir.getName(); if(server.equals("")) {

我尝试使用Java创建LotusNotes客户机。现在,我在列出所有用户定义的数据库时遇到了一个问题。我想做的是

// testing purpose
private void printAllDb() throws NotesException
{
    DbDirectory dir = session.getDbDirectory(host);
    String server = dir.getName();
    if(server.equals(""))
    {
        server = "Local";
    }

    System.out.println("database direcory list on server (" + server + ")");
    Database db = dir.getFirstDatabase(DbDirectory.DATABASE);

    do
    {
        System.out.println("file name: " + db.getFileName().toUpperCase() + " - " + db.getTitle());

    } while((db = dir.getNextDatabase()) != null);

}
但是,程序将抛出异常:

Exception in thread "main" NotesException: Server access denied
at lotus.domino.NotesExceptionHelper.read(Unknown Source)
at lotus.domino.NotesExceptionHolder._read(Unknown Source)
at lotus.priv.CORBA.iiop.RepImpl.invoke(Unknown Source)
at lotus.priv.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at lotus.domino.corba._IDbDirectoryStub.getFirstDatabase(Unknown Source)
at lotus.domino.cso.DbDirectory.getFirstDatabase(Unknown Source)
at nz.co.sylresearch.sylsearch.agents.lotusnotes.LotusNotesAPIHandler.printAllDb(LotusNotesAPIHandler.java:58)
at nz.co.sylresearch.sylsearch.agents.lotusnotes.LotusNotesAPIHandler.main(LotusNotesAPIHandler.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

问题很清楚。您正在获取对服务器的访问被拒绝错误。现在棘手的部分是找出原因


您应该首先确保用于创建会话对象的用户名和密码正确。然后确保用户有权访问服务器,并有权在服务器上运行Java代码。您必须检查目录中的服务器文档

谢谢你的回复,你能告诉我应该选择哪个服务器文档吗?我尝试使用createSessionWithFullAccess创建会话,但它不起作用,并抛出一个类not found Exception他在Domino目录(即names.nsf数据库)中引用服务器文档中的“host”(不管真实名称是什么——这只是变量名,我们不知道值),使用Domino管理员客户端可以很容易地找到它。从文档中,我相信createSessionWithFullAccess需要与Notes ID文件对应的密码。您使用的是ncso.jar文件,它使用IIOP/CORBA与Domino通信,因此它不需要(也不能使用)Notes ID文件。所以我不是100%确定这一点,但我认为这意味着不能将CreateSessionWithFullAccess与ncso.jar一起使用。