我有Domino服务器(9.0.1 FP2 HF384),其中ExtLib(9.0.1.v00_12_20150311-1316)和OpenNTF Domino API(2.0.0.201510032142)作为OSGI插件运行。 我尝试了一个简单的代码:
Database db = Factory.getSession().getCurrentDatabase();
System.out.println(db.getApiPath());
for (View view : db.getViews()) {
System.out.println(view.getName());
}
当代码第一次运行时(HTTP任务启动后)我得到一个错误堆栈(更低)并且结果正确:
HTTP JVM: java.security.PrivilegedActionException: NotesException: Cannot create a session from an agent
HTTP JVM: at java.security.AccessController.doPrivileged(AccessController.java:331)
HTTP JVM: at org.openntf.domino.utils.Factory$SetupJob.run(Factory.java:63)
HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)
HTTP JVM: Caused by:
HTTP JVM: NotesException: Cannot create a session from an agent
HTTP JVM: at lotus.domino.local.Session.checkSecurityManagerExtender(Unknown Source)
HTTP JVM: at lotus.domino.local.Session.createSession(Unknown Source)
HTTP JVM: at lotus.domino.NotesFactory.createSession(Unknown Source)
HTTP JVM: at org.openntf.domino.utils.Factory$SetupJob$1.run(Factory.java:66)
HTTP JVM: at java.security.AccessController.doPrivileged(AccessController.java:327)
HTTP JVM: ... 2 more
HTTP JVM: java.security.PrivilegedActionException: java.io.FileNotFoundException: C:\Lotus\Domino\null\IBM_TECHNICAL_SUPPORT\org.openntf.0.0.log.lck (The system cannot find the path specified.)
HTTP JVM: at java.security.AccessController.doPrivileged(AccessController.java:331)
HTTP JVM: at org.openntf.domino.utils.Factory$SetupJob.run(Factory.java:79)
HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)
HTTP JVM: Caused by:
HTTP JVM: java.io.FileNotFoundException: C:\Lotus\Domino\null\IBM_TECHNICAL_SUPPORT\org.openntf.0.0.log.lck (The system cannot find the path specified.)
HTTP JVM: at java.io.FileOutputStream.<init>(FileOutputStream.java:204)
HTTP JVM: at java.io.FileOutputStream.<init>(FileOutputStream.java:94)
HTTP JVM: at java.util.logging.FileHandler.initOutputFiles(FileHandler.java:225)
HTTP JVM: at java.util.logging.FileHandler.init(FileHandler.java:195)
HTTP JVM: at java.util.logging.FileHandler.<init>(FileHandler.java:517)
HTTP JVM: at org.openntf.domino.logging.DefaultFileHandler.<init>(DefaultFileHandler.java:98)
HTTP JVM: at org.openntf.domino.utils.Factory$SetupJob$2.run(Factory.java:86)
HTTP JVM: at java.security.AccessController.doPrivileged(AccessController.java:327)
但是,当我再次在线上运行此代码时
for (View view : db.getViews()) {
我得到了:
[ODA::WARNING] null
[ODA::WARNING] (source:org.openntf.domino.utils.DominoUtils$4.run - See IBM_TECHNICAL_SUPPORT\org.openntf.log.X.Y.txt for full stack trace.)
[ODA::WARNING] null
[ODA::WARNING] (source:org.openntf.domino.utils.DominoUtils$4.run - See IBM_TECHNICAL_SUPPORT\org.openntf.log.X.Y.txt for full stack trace.)
HTTP JVM: javax.faces.el.EvaluationException: java.lang.NullPointerException
HTTP JVM: at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:142)
HTTP JVM: at com.ibm.xsp.component.UIViewRootEx.initAfterContents(UIViewRootEx.java:1690)
HTTP JVM: at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:335)
HTTP JVM: at com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256)
HTTP JVM: at com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167)
HTTP JVM: at com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:521)
HTTP JVM: at com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:567)
HTTP JVM: at com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:142)
HTTP JVM: at com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90)
HTTP JVM: at frostillicus.controller.ControllingViewHandler.createView(ControllingViewHandler.java:70)
HTTP JVM: at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:251)
HTTP JVM: at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
HTTP JVM: at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
HTTP JVM: at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
HTTP JVM: at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
HTTP JVM: at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
HTTP JVM: at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
HTTP JVM: at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
HTTP JVM: at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
HTTP JVM: at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
HTTP JVM: at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
HTTP JVM: Caused by:
HTTP JVM: java.lang.NullPointerException
这是org.openntf.x.y.txt中的内容:
lotus.domino.local.NotesBase.CheckObject - null
NotesException: Object has been removed or recycled
at lotus.domino.local.NotesBase.CheckObject(Unknown Source)
at lotus.domino.local.Session.getDatabase(Unknown Source)
at org.openntf.domino.impl.Database.resurrect(Database.java:2648)
at org.openntf.domino.impl.Database.getDelegate(Database.java:2638)
at org.openntf.domino.impl.Database.getViews(Database.java:1642)
出了什么问题?我有另一个(类似的Domino服务器,版本和插件),一切都运行得很好!
已更新 在HTTP任务开始我得到:
[ODA] Starting the OpenNTF Domino API... Using notes.ini: C:\Lotus\Domino\notes.ini
[ODA] OpenNTF API Version 2.0.0.201510032142 started
HTTP JVM: Logging.logCfgFilePrecheck: File 'E:\Lotus\Domino\data/IBM_TECHNICAL_SUPPORT/org.openntf.domino.logging.logconfig.properties' not found
HTTP JVM: Logging: Couldn't initialize from PropertyFile; activating fallback ...
[ODA] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[ODA] Operation of BackendBridge.getViewEntryByKeyWithOptions FAILED
[ODA] Please read the comments in org.openntf.domino.xsp.ODAPlatform
[ODA] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[ODA::Xots] Starting XPages OSGi Tasklet Service with 10 core threads.
[ODA::XOTS] Registering tasklet org.openntf.domino.xsp.xots.XotsNsfScanner@4c904c9
XSP Command Manager initialized
HTTP Server: Restarted
答案 0 :(得分:1)
你在哪里添加代码?到XPage?不是代理人,你......?据我所知,它不会从代理商那里工作......
我从托管bean中使用了很多ODA - 而且我没有看到这些问题。
加载http任务时可以忽略的警告。这些消息不应写入控制台,并且在版本发布时错误地留在那里(据我所知 - 但Paul Withers会更详细地了解)。
/约翰
答案 1 :(得分:0)
要获得会话,我建议使用隐式变量。如果你有:
org.openntf.domino.xsp=godmode
您从XPage session
和database
熟悉的隐式变量会被覆盖,因此它们是ODA当前会话和数据库。如果您不使用godmode,我们会添加变量opensession
和opendatabase
。类似的命名约定用于sessionAsSigner和sessionAsSignerFullAccess。然后,您可以正常使用ExtLibUtil.resolveVariable()
来获取隐式变量。
查看日志消息,它看起来并没有找到正确安装Domino的路径 - java.io.FileNotFoundException: C:\Lotus\Domino\null\IBM_TECHNICAL_SUPPORT\org.openntf.0.0.log.lck
。这可能与原因有关。我怀疑当HTTP启动时它向控制台写错误说它无法找到配置,所以没有启动ODA工厂。
关键方法是Factory.getConfigFileFallback。在下面的代码中,它使用系统变量来识别启动Factory时的notes.ini路径。如果找不到notes.ini,则无法成功启动工厂,因此session
和database
无法使用。
private static File getConfigFileFallback() {
String progpath = System.getProperty("notes.binary");
File iniFile = new File(progpath + System.getProperty("file.separator") + "notes.ini");
if (!iniFile.exists()) {
// System.out.println("Inifile not found on notes.binary path: " + progpath);
progpath = System.getProperty("user.dir");
iniFile = new File(progpath + System.getProperty("file.separator") + "notes.ini");
}
if (!iniFile.exists()) {
// System.out.println("Inifile not found on notes.binary path: " + progpath);
progpath = System.getProperty("java.home");
if (progpath.endsWith("jvm")) {
iniFile = new File(progpath + System.getProperty("file.separator") + ".." + System.getProperty("file.separator")
+ "notes.ini");
} else {
iniFile = new File(progpath + System.getProperty("file.separator") + "notes.ini");
}
}
if (!iniFile.exists()) {
progpath = System.getProperty("java.library.path"); // Otherwise the tests will not work
iniFile = new File(progpath + System.getProperty("file.separator") + "notes.ini");
}
if (!iniFile.exists()) {
// System.out.println("Inifile still not found on user.dir path: " + progpath);
if (progpath.contains("framework")) {
String pp2 = progpath.replace("framework", "");
iniFile = new File(pp2 + "notes.ini");
// System.out.println("Attempting to use path: " + pp2);
if (!iniFile.exists()) {
Factory.println("WARNING: Unable to read environment for log setup. Please look at the following properties...");
for (Object rawName : System.getProperties().keySet()) {
if (rawName instanceof String) {
Factory.println((String) rawName + " = " + System.getProperty((String) rawName));
}
}
}
}
}
return iniFile;
}
请确认notes.binary系统属性指向notes.ini的正确位置,并且对其中的数据文件夹的引用是正确的。
答案 2 :(得分:0)
所以实际上我不知道是什么原因引起了这个问题。它可能是一些服务器补丁和修复程序相互安装,但解决问题的是干净的服务器重新安装。服务器文档和其他设置保持不变。