I'm trying to get a session in java being called from an Agent. The getSession()
call was working fine in V3, but I'm getting the "org.openntf.domino.utils.Factory is not initialized for this Thread!" error. There's an error message in the Factory Class that states "If you are running in an Agent, make sure you start with a call to Factory.setSession()
and pass in your lotus.domino.Session", but that method seems to be commented out in the Factory Class now.
I tried to change from getSession()
to getAgentSession()
, but I wasn't expecting that to work as it's the Factory that's the issue.
In the lib/ext directory on the server I have the following two jar files:
- org.openntf.domino_10.0.1.201905061230.jar
- org.openntf.formula_10.0.1.201905061230.jar
I added the org.openntf.formula jar as there was an error in the log saying a class from there was missing.
I have full admin rights to the server, Manager access to the nsf and have the Runtime security level for the agent set to "3. Allow restricted operations with full administration rights"
Edit: I added some code to see if I could persuade the Factory to initialize, but I'm still getting the same error even after handing in a lotus.domino Session:
if(!Factory.isStarted()) {
System.out.println("Factory.startup");
Factory.startup(NotesFactory.createSession());
} else {
System.out.println("Factory shutdown and restart");
Factory.shutdown();
Factory.startup(NotesFactory.createSession());
}
More hacking in an attempt to solve the problem. This code...
lotus.domino.Session lnSession = lotus.domino.NotesFactory.createSession();
System.out.println("Session Common User Name: " + lnSession.getCommonUserName());
if(!Factory.isStarted()) {
System.out.println("Factory.startup");
Factory.startup(lnSession);
} else {
System.out.println("Factory shutdown and restart");
Factory.shutdown();
Factory.startup(lnSession);
}
Session session = Factory.getSession();
... gave me the following. Interestingly, there's no issue getting a lotus.domino Session and when handed into the openNTF Factory, it still has the issue. Is this a bug, or is there something I'm missing. I checked the security tab in the server doc and the server is named with full access, as well as me.
Note: dev2server is our Domino 10.01 test server to test the applications before moving them from 9.0.1 FP8 to 10.0.1 FP1.
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: Session Common User Name: dev2server
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: Factory shutdown and restart
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: [ODA] Shutting down the OpenNTF Domino API...
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: [ODA] OpenNTF Domino API shut down
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: [ODA] Starting the OpenNTF Domino API... Using notes.ini: C:\Lotus\Domino\notes.ini
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: [ODA] OpenNTF API Version 10.0.1.201905061230 started
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') printing: Logging: LogConfig successfully initialized from D:\Lotus\Domino\data/IBM_TECHNICAL_SUPPORT/org.openntf.domino.logging.logconfig.properties
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: java.lang.IllegalStateException: org.openntf.domino.utils.Factory is not initialized for this thread!
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at org.openntf.domino.utils.Factory.getThreadVariables(Factory.java:346)
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at org.openntf.domino.utils.Factory.getSession(Factory.java:953)
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at org.openntf.domino.utils.Factory.getSession(Factory.java:859)
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at ProcessMailInRequests.NotesMain(ProcessMailInRequests.java:89)
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at lotus.domino.AgentBase.runNotes(Unknown Source)
06/24/2019 07:45:43 PM AMgr: Agent ('ProcessMail-InRequests PMIR' in 'batch\batchquery.nsf') error message: at lotus.domino.NotesThread.run(Unknown Source)
Thanks, Scott.