谁用过domino java class?

hawaii 2001-10-17 10:11:04
在下对domino一窍不通,想用java访问domino的数据库。谁用过domino java class,给推荐几篇文档看看。
多谢多谢!
...全文
473 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hawaii 2001-10-29
  • 打赏
  • 举报
回复
load diiop成功了。是我没有设置好主机名。

但是仍然无法访问服务器的数据库。
具体如下:
1、
Session s = NotesFactory.createSession();
Database db = s.getDatabase("","names.nsf");
结果:成功访问了客户端的names.nsf。为什么是客户端的,不是本地服务器的?domino java
class类和客户端有什么关系?

2、
Session s = NotesFactory.createSession();
Database db = s.getDatabase("cpnc-oaserver", "names.nsf");
View vw = db.getView("People");
结果:出错,
lotus.domino.NotesException
at lotus.domino.local.Database.Nopen(Native Method)
at lotus.domino.local.Database.open(Database.java:545)
at Names.runNotes(Names.java:25)
at lotus.domino.NotesThread.run(NotesThread.java:203)
exception id: 4043
exception description: Database open failed (%1)
出错行在View vw = db.getView("People");
我用db.open()打开时,错误相同,出错行在db.open()行。
此错误前几天都没有出过!:-(

3、
Session s = NotesFactory.createSession("cnpc-oaserver", "admin", "password");
Database db = s.getDatabase("","names.nsf");
结果:出错,
lotus.domino.NotesException
at lotus.domino.NotesExceptionHelper.read(NotesExceptionHelper.java)
at lotus.domino.NotesExceptionHolder._read(NotesExceptionHolder.java)
at com.ibm.CORBA.iiop.RepImpl.invoke(RepImpl.java:325)
at com.ibm.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:36)
at lotus.domino.corba._IObjectServerStub.createSession(_IObjectServerStu
b.java)
at lotus.domino.cso.Session.OREFtoSession(Session.java:819)
at lotus.domino.cso.Session.<init>(Session.java:73)
at lotus.domino.cso.Session.createSession(Session.java:41)
at lotus.domino.NotesFactory.createSession(NotesFactory.java:67)
at Names.runNotes(Names.java:19)
at lotus.domino.NotesThread.run(NotesThread.java:203)
exception id: 4486
exception description:

高手help!
thanks a lot!


hawaii 2001-10-25
  • 打赏
  • 举报
回复
在standalone application中可以访问。
在jsp或servlet中不能访问。为什么?

高手呢?
hawaii 2001-10-25
  • 打赏
  • 举报
回复
还有:
我的domino server输入load diiop时提示:
DIIOP Server is unable to determine host name or host ip address
无法启动,是什么意思?
hawaii 2001-10-25
  • 打赏
  • 举报
回复
多谢chinakid_jms(红松)!^_^
麻烦你回答我下面的问题。

我在classpath里都设了。notes.jar在前。
文件头 import lotus.domino.*;
是不是notes.jar和Ncso.jar的类包是相似的?

我的问题主要有三个:
1、在jsp或servlet中无法访问。我是按照例程改的。
2、Session s = NotesFactory.createSession("zbyy-server", "admin", "password");
不能用啊?为什么?只能用Session s = NotesFactory.createSession();,如果是后者它会提示我输入当前客户端id的password啊。
3、names.nsf中的HTTPPassword是不是没有办法转换阿?

下面是我的测试程序,第一个是servlet,第二个是standalone application
1、NotesServlet.java
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import lotus.domino.*;

public class NotesServlet extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out;
String msg = "";

res.setContentType("text/html");
out = res.getWriter();

out.println("<html>");
out.println("<head><title>Test</title></head>");
out.println("<body>");
out.println("<h1>Test</h1>");
out.println("<h2>This is the servlet program to connect domino database.</h2>");

try {
NotesThread.sinitThread();
Session s = NotesFactory.createSession();
Database db = s.getDatabase("", "names.nsf");
// Database db = s.getDatabase("zbyy-server", "names.nsf");
if (db != null) {
View vw = db.getView("People");
if (vw != null) {
Document doc = null;
doc = vw.getFirstDocument();
Vector items = doc.getItems();
System.out.println("items : ");
Enumeration enum = items.elements();
while (enum.hasMoreElements()) {
System.out.println(enum.nextElement());
}
while (doc != null) {
String shortName = doc.getItemValueString("ShortName");
String firstName = doc.getItemValueString("FirstName");
String lastName = doc.getItemValueString("LastName");
String password = doc.getItemValueString("HTTPPassword");
String mailFile = doc.getItemValueString("MailFile");
doc = vw.getNextDocument(doc);
}
vw.recycle();
}
db.recycle();
} else {
out.println("Error accessing database.");
}
s.recycle();
NotesThread.stermThread();
} catch(NotesException e) {
e.printStackTrace();
}
out.println("</body></html>");

}

public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
doGet(req, res);
}
}

2、Names.java
import lotus.domino.*;
import java.util.*;
public class Names extends NotesThread
{
public static void main(String argv[])
{
Names t = new Names();
t.start();
}
public void runNotes()
{
try
{
Session s = NotesFactory.createSession();
// Session s = NotesFactory.createSession("server", "admin", "password");
if (s != null) {
// Database db = s.getDatabase("","names.nsf");
Database db = s.getDatabase("server", "names.nsf");
if (db != null) {
View vw = db.getView("People");
if (vw != null) {
Document doc = null;
doc = vw.getFirstDocument();
Vector items = doc.getItems();
System.out.println("items : ");
Enumeration enum = items.elements();
while (enum.hasMoreElements()) {
System.out.println(enum.nextElement());
}

while (doc != null) {
String firstName = doc.getItemValueString("FirstName");
String lastName = doc.getItemValueString("LastName");
String password = doc.getItemValueString("HTTPPassword");
String mailFile = doc.getItemValueString("MailFile");
// String checkPassword = doc.getItemValueString("CheckPassword");
// String passwordDigest = doc.getItemValueString("PasswordDigest");
String address = doc.getItemValueString("OfficeStreetAddress");
String city = doc.getItemValueString("OfficeCity");
String state = doc.getItemValueString("OfficeState");
String zip = doc.getItemValueString("OfficeZIP");
System.out.print("<firstname>" + firstName);
System.out.print("<lastname>" + lastName);
System.out.print("<http password>" + password);
System.out.print("<mail file>" + mailFile);
// System.out.print("<check password>" + checkPassword);
// System.out.print("<password digest>" + passwordDigest);
System.out.println("");
doc = vw.getNextDocument(doc);
}
vw.recycle();
}
db.recycle();
} else {
System.out.println("Error accessing database.");
}
s.recycle();
} else {
System.out.print("Error - session could not.");
System.out.println("be established.");
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
chinakid_jms 2001-10-25
  • 打赏
  • 举报
回复
你调的是notes.jar?还是ncso.jar?客户端运行最好用Ncso.jar,服务器运行用notes.jar
hawaii 2001-10-19
  • 打赏
  • 举报
回复
我写了一个java程序访问本地的names.nsf,可以。访问服务器上的names.nsf时就不行了,在这一行出错:
Session s = NotesFactory.createSession("servername", "admin/CNPC", "password");

出错信息是:
lotus.domino.NotesException
at lotus.domino.NotesFactory.getIOR(NotesFactory.java:268)
at lotus.domino.NotesFactory.createSession(NotesFactory.java:66)
at Names.runNotes(Names.java:17)
at lotus.domino.NotesThread.run(NotesThread.java:203)

高手指点一下下。多谢多谢!
hawaii 2001-10-19
  • 打赏
  • 举报
回复
1、访问服务器上的库文件问题解决了。不过,代码是这样的:
Session s = NotesFactory.createSession();
Database db = s.getDatabase("zbyy-server", "names.nsf");
在执行的时候,必须输入notes当前id的password。按书上说的:
Session s = NotesFactory.createSession("zbyy-server", "admin", "password");
还是不行啊,错误见上一贴子。

2、names.nsf取出后,密码HTTPPassword是(63E4BD1FEFD8913B15A5EF484A3F6B06),如何转换?

help!help!help!
chengdong 2001-10-17
  • 打赏
  • 举报
回复
NOTES提供大量JAVA API,可以通过他们来做
yw_w 2001-10-17
  • 打赏
  • 举报
回复
在java api 中有例子

536

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧