Domino通过SAPJCO.jar连接SAP的问题.

cafeson 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>";
}

}
...全文
588 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
georgekreisler 2008-04-14
  • 打赏
  • 举报
回复
缺少sapjcorfc.dll librfc32.dll文件,下载后放到System32下

535

社区成员

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

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