Pat*_*ten 0 xpages xpages-ssjs
在xpage上,我运行以下代码:
function setPersonInfoCommon(x) {
//print("test printing to console value: " + x)
var serv = getPreferenceField("tx_server");
//e.g. "Development1";
var dbname = getPreferenceField("tx_loc_personal_common");
//e.g. "CustomerX\\Personnel.nsf"
var db:NotesDatabase = session.getDatabase(serv,dbname);
if (db == null) {
requestScope.status = "Database not found.";
return;
}
var vw:NotesView = db.getView("LookUpUsersUNID");
if (vw == null) {
requestScope.status = "View not found.";
return;
}
var doc:NotesDocument = vw.getDocumentByKey(x);
if (doc == null) {
requestScope.status = "Document not found.";
return;
}
else{
requestScope.status = "Document created:" + getCreated();
}
}
Run Code Online (Sandbox Code Playgroud)
该冻结我的XPage,并在日志中我看到了下面的符号:2014年8月19日12时46分11秒HTTP JVM:com.ibm.xsp.webapp.FacesServlet $ ExtendedServletException:com.ibm.xsp.FacesExceptionEx:java.io .NotSerializableException:lotus.domino.local.DateTime 2014-08-19 12:46:11 HTTP JVM:CLFAD0134E:处理XPage请求的异常.有关更多详细信息,请参阅位于E:/ Domino/data/domino/workspace/logs中的error-log-0.xml
XPage驻留在与我执行getDocumentByKey方法的NSF不同的NSF中.但是我没有得到任何迹象表明无法找到数据库(db)或视图(vw).如果我通过输出文件路径或其他东西来检查它,我会得到正确的值.
我测试从NSF中运行代码我执行getDocumentByKey方法然后代码运行得很好.
可能是什么原因?
我通过网络登录并拥有适当的权利.
在发布问题之前,请始终查看指定位置中的更详细日志.这些消息提供了更多信息,有助于识别导致问题的代码,通常还有更详细的解释.
在此特定情况下,控制台日志上的消息包括"java.io.NotSerializableException:lotus.domino.local.DateTime".假设这与行相关requestScope.status = "Document created:" + getCreated();(详细日志将确认),getCreated()实际上doc.getCreated(),这将返回NotesDateTime对象.
NotesDateTime对象和任何其他Domino对象都不能放在任何作用域变量中(有各种博客解释Domino对象不可序列化).
如果你想要把一个日期/时间的范围,就可以使用获取Java日期等同NotesDateTime.toJavaDate(),所以doc.getCreated().toJavaDate().
| 归档时间: |
|
| 查看次数: |
1243 次 |
| 最近记录: |