您的位置:程序门 -> 企业开发 -> lotus



domino通过sapjco.jar连接sap的问题.


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


domino通过sapjco.jar连接sap的问题.
发表于:2008-01-21 09:03:16 楼主
//当运行到jco.createclient时,产生如下错误.   请高手指点.
01/20/2008   07:17:02   pm     amgr:   agent   ('(java   xxx   sap)   ¦   jagcreateso'   in   'develop\xxxproject\xxxapp.nsf')   error   message:   java.lang.exceptionininitializererror:   jco.classinitialize():   could   not   load   middleware   layer   'com.sap.mw.jco.rfc.middlewarerfc'
d:\lotus\domino\jvm\lib\ext\x86\sapjcorfc.dll


import   java.io.printwriter;

import   lotus.domino.*;

import   com.sap.mw.jco.*;

/**
  *   @author   thomas   g.   schuessler,   arasoft   gmbh   http://www.arasoft.de
  */
public   class   jc_sap   {
jco.client   mconnection;

private   string   sreturnmsg   =   "";

jco.repository   mrepository;

private   database   dbcur   =   null;

private   document   docsys   =   null;

private   view   vwsys   =   null;

private   printwriter   pw;

public   jc_sap(agentcontext   agcontext,   printwriter   pw)   {
try   {
dbcur   =   agcontext.getcurrentdatabase();
this.pw   =   pw;
initialsap("vadminsysconfig");
}   catch   (notesexception   e)   {
this.setsreturnmsg(e.getmessage());
//   todo   auto-generated   catch   block
e.printstacktrace();
}
}

public   jc_sap(agentcontext   agcontext,   printwriter   pw,string   sviewname)   {
try   {
dbcur   =   agcontext.getcurrentdatabase();
this.pw   =   pw;
initialsap(sviewname);
}   catch   (notesexception   e)   {
this.setsreturnmsg(e.getmessage());
//   todo   auto-generated   catch   block
e.printstacktrace();
}
}

public   void   initialsap(string   sviewname)   throws   notesexception   {
vwsys   =   dbcur.getview(sviewname);
docsys   =   vwsys.getfirstdocument();
try   {
system.out.print(jco.type_float);
//   change   the   logon   information   to   your   own   system/user
system.out.println(docsys.getitemvaluestring("saphostname"));
mconnection   =   jco.createclient(docsys
.getitemvaluestring("sapclient"),   //   sap   client
docsys.getitemvaluestring("sapuser"),   //   userid
docsys.getitemvaluestring("sappassword"),   //   password
docsys.getitemvaluestring("saplanguage"),   //   language
docsys.getitemvaluestring("saphostname"),   //   server_host
docsys.getitemvaluestring("sapsystem"));   //   system   number
mconnection.connect();

mrepository   =   new   jco.repository("arasoft",   mconnection);
}   catch   (exception   e)   {
system.out.print(e.getlocalizedmessage());
this
.setsreturnmsg("to   connect   sap   failed.   please   check   connection   string...");
e.printstacktrace();
//   system.exit(1);
}
mconnection.disconnect();
}

public   jco.function   createfunction(string   name)   throws   exception   {
try   {
ifunctiontemplate   ft   =   mrepository.getfunctiontemplate(name
.touppercase());
if   (ft   ==   null)
return   null;
return   ft.getfunction();
}   catch   (exception   e)   {
this.setsreturnmsg("problem   retrieving   jco.function   object   "   +   name
+   ".");
return   null;
}
}

public   void   logoff()   {
this.mconnection.disconnect();
}

public   string   getsreturnmsg()   {
return   sreturnmsg;
}

public   void   setsreturnmsg(string   returnmsg)   {
sreturnmsg   =   sreturnmsg   +   " <br> "   +   " <font> "   +   returnmsg   +   " </font> ";
}

}
该帖包含附件:


快速检索

最新资讯
热门点击