Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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
异步调用代理Xpages_Xpages - Fatal编程技术网

异步调用代理Xpages

异步调用代理Xpages,xpages,Xpages,我在OpenNTF.org上获得了线程和作业应用程序的代码 import lotus.domino.notesception; 导入lotus.domino.Session; 导入org.eclipse.core.runtime.IProgressMonitor; 导入org.eclipse.core.runtime.IStatus; 导入org.eclipse.core.runtime.Status; 导入org.eclipse.core.runtime.jobs.IJobChangeEven

我在OpenNTF.org上获得了线程和作业应用程序的代码

import lotus.domino.notesception;
导入lotus.domino.Session;
导入org.eclipse.core.runtime.IProgressMonitor;
导入org.eclipse.core.runtime.IStatus;
导入org.eclipse.core.runtime.Status;
导入org.eclipse.core.runtime.jobs.IJobChangeEvent;
导入org.eclipse.core.runtime.jobs.Job;
导入org.eclipse.core.runtime.jobs.JobChangeAdapter;
导入com.ibm.domino.xsp.module.nsf.ThreadSessionExecutor;
公职人员{
publicstaticvoidstart(stringdbpath、stringagentname、stringparamdocid){
已同步(JobRunner.class){
runningJob=新的ISPJob(dbPath、agentName、paramDocId);
runningJob.addJobChangeListener(新的JobChangeAdapter(){
公共作废完成(IJobChangeEvent事件){
System.out.println(“完成事件”);
runningJob=null;
}
});
AccessController.doPrivileged(新的PrivilegedAction(){
公共对象运行(){
runningJob.schedule();
返回null;
}
});
}
}
私有静态ISPJob运行job;
私有静态最终类ISPJob扩展作业{
私有线程SessionExecutor执行器;
私有字符串docId;
私有字符串路径;
私有字符串代理名;
公共ISPJob(字符串paramDbPath、字符串paramAgentName、字符串paramDocId){
super(paramDocId);
this.docId=paramDocId;
this.dbPath=paramDbPath;
this.agentName=paramAgentName;
this.executor=新线程SessionExecutor(){
@凌驾
受保护的IStatus运行(会话)引发NotesException{
System.out.println(“作业已启动”+docId);
System.out.println(“>>创建的会话:”
+session.getUserName()+,有效用户:
+session.getEffectiveUserName());
Database db=session.getDatabase(null,dbPath);
如果(db!=null){
试一试{
如果(!db.isOpen())db.open();
if(db.isOpen()){
System.out.println(“>>数据库已打开:”
+db.getTitle());
Agent=db.getAgent(agentName);
试一试{
System.out.println(“>>代理已启动:“+Agent.getName());
agent.run(docId);
System.out.println(“>>代理运行:“+Agent.getName());
}最后{
agent.recycle();
}
}
}最后{
db.recycle();
}
}
System.out.println(“作业完成”);
返回状态。OK_状态;
}
};
}
受保护的IStatus运行(IProgressMonitor监视器){
试一试{
返回executor.run();
}捕获(例外情况除外){
返回状态。取消状态;
}
}
};
}
我在按钮(SSJS)上的
onclick
事件中使用了代码(
JobRunner
类)


返回以下错误

"Error 500 http web server command not handled exception"

有什么问题吗?

如果您遇到Eclipse运行时类的
ClassNotFoundException
(在workspace/logs文件夹中),这意味着XPages会阻止您使用这些类进行安全保护。通常,使用java.policy文件授予所有权限可以解决此问题

然而,对于不同的Domino版本,我在
ThreadSessionExecuter
类中遇到了错误和不一致的行为。我也在9.0.1上测试了你的代码,在我的测试服务器上也遇到了这样的问题

您可以使用另一种方法。您可以参考我的博客,其中包含指向ICONUK 2013演示数据库和幻灯片组的链接

还要检查OpenNTF中的项目。它为运行后台任务提供了一个插件框架。

在我的日志中,我有一个“ClassNotFoundException”, 我已修改了文件java.policy并重新启动服务器,但错误仍在继续

C:\ProgramFiles\IBM\Lotus\Domino\jvm\lib\security

// Notes java code gets all permissions

grant codeBase "file:${notes.binary}/*" {
    permission java.security.AllPermission;
};

grant codeBase "file:${notes.binary}/rjext/*" {
    permission java.security.AllPermission;
};

grant codeBase "file:${notes.binary}/ndext/*" {
    permission java.security.AllPermission;
};

grant codeBase "file:${notes.binary}/xsp/-" {
    permission java.security.AllPermission;
};

grant codeBase "file:${notes.binary}/osgi/-" {
    permission java.security.AllPermission;
};


// My new line
grant {
   permission java.security.AllPermission;
};

出于好奇,您是否在Xsp属性页面中选中了“显示XPage运行时错误页面”?如果没有,您可能会看到一些额外的信息。这是一个愚蠢的问题,但我必须问:您的包是否命名为“myPck”,而不是类似于“com.company.myPck”的东西?您的Domino版本是什么?我检查了“Display XPage runtime error Page”。是的,我的包是“com.company.myPck”。Domino是9.0。1@user3873177:我有点困惑,因为您将您的问题标记为Serdar Basegmez的回答,但还添加了另一个回答,说明更改权限并不能解决问题。如果问题仍未解决,您应该在XPage上使用“com.company.myPck.JobRunner.start(…)”而不是“myPck.JobRunner.start(…)”。如果没有在SSJS中显式导入包,则始终需要使用完整的包名调用它。