0
votes

I have Domino Server (9.0.1 FP2 HF384) with ExtLib (9.0.1.v00_12_20150311-1316) and OpenNTF Domino API (2.0.0.201510032142) running as OSGI plugins. I try a simple code:

Database db = Factory.getSession().getCurrentDatabase();
System.out.println(db.getApiPath());
for (View view : db.getViews()) {
    System.out.println(view.getName());
}

When code runs for the first time (after HTTP task started) i'm getting an error stack (lower) and correct result:

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)

But, when I run this code again on line

for (View view : db.getViews()) {

I'm getting:

[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

That's what in 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)

What's wrong? I have another (similar Domino Server, version and plugins) where everything runs perfectly!

UPDATED On HTTP task start I'm getting:

[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
3
I am also getting a similar error: 07/26/2016 08:29:20 AM [ODA::WARNING] null 07/26/2016 08:29:20 AM [ODA::WARNING] (source:org.openntf.domino.utils.DominoUtils$4.run - See IBM_TECHNICAL_SUPPORT\org.openntf.log.X.Y.txt for full stack trace.) My code is not being run from an agent.Ryan Buening

3 Answers

1
votes

Where did you add the code? To an XPage? Not in an agent, did you...? It won't work from an agent as far as I know...

I use ODA a LOT from managed beans - and I don't see those problems.

The warnings you get when loading the http task you can ignore. Those messages should not be written to the console and were by mistake left in there when the version was released (as far as I understand - but Paul Withers will know in more detail).

/John

0
votes

To get the session I would recommend using the implicit variables. If you have:

org.openntf.domino.xsp=godmode

The implicit variables you're familiar with from XPages, session and database, are overwritten, so they're ODA current session and database. If you're not using godmode, we add the variables opensession and opendatabase. Similar naming conventions are used for sessionAsSigner and sessionAsSignerFullAccess. You can then use ExtLibUtil.resolveVariable() as normal to get the implicit variables.

Looking at the logging message it doesn't look like it's finding the path to the Domino install correctly - java.io.FileNotFoundException: C:\Lotus\Domino\null\IBM_TECHNICAL_SUPPORT\org.openntf.0.0.log.lck. That's likely to be related to the cause. I suspect when HTTP starts it's writing an error to the console saying it can't find the config, so not starting the ODA Factory.

The key method is Factory.getConfigFileFallback. It uses system variables to identify notes.ini paths when starting the Factory, in the code below. If it can't find the notes.ini, it won't be able to start the Factory successfully, so session and database won't be available.

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

Please confirm notes.binary system property is pointing to the correct location for the notes.ini and references to the data folder in it are correct.

0
votes

So in fact I don't know what caused the problem. It might be some server patches and fixes intalled one on another, BUT what solve the problem is clean server re-install. Server document and other settings stayed the same.