When performing several simultaneous requests am getting the following error:
[INFO] Entering CountResponse.
[ERROR] java.lang.NullPointerException
org.apache.axis2.AxisFault: java.lang.NullPointerException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.ttdev.ss.SimpleServiceDominoMessageReceiverInOut.invokeBusinessLogic(SimpleServiceDominoMessageReceiverInOut.java:65)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: de.bea.domingo.service.NotesServiceRuntimeException: java.lang.NullPointerException
at de.bea.domingo.service.NotesServiceFactory.disposeInstance(NotesServiceFactory.java:294)
at de.bea.domingo.DNotesFactory.dispose(DNotesFactory.java:452)
at com.ttdev.ss.SimpleServiceDominoSkeleton.dispose(SimpleServiceDominoSkeleton.java:86)
at com.ttdev.ss.SimpleServiceDominoSkeleton.count(SimpleServiceDominoSkeleton.java:75)
at com.ttdev.ss.SimpleServiceDominoMessageReceiverInOut.invokeBusinessLogic(SimpleServiceDominoMessageReceiverInOut.java:48)
... 19 more
Caused by: java.lang.NullPointerException
at de.bea.domingo.service.NotesServiceFactory.invoke(NotesServiceFactory.java:359)
at de.bea.domingo.service.NotesServiceFactory.disposeInstance(NotesServiceFactory.java:290)
... 23 more
[INFO] Exiting CountResponse.
Also when running "tell diiop show users" at the admin console, the sessions remain active.
I would really appreciate some input about the proper way to invoke the dispose method in such environment (tomcat/axis2 accessing domino 7.3 through DIIOP).
Thanks in advance,
Diego
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It should be used the method DNotesFactory.newInstance() instead of DNotesFactory.getInstance() for the server base application to obtain a new factory instance each time. The method DNotesFactory.getInstance() just return a singleton instance.
I use the below methods to connect and disconnect domino, as so far it works properly.
Getting a new factory instance:
factory = DNotesFactory.newInstance("de.bea.domingo.proxy.NotesProxyFactory");
Dispose a instance (disconnect):
factory.disposeInstance(true);
I hope it can be helpful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/*
* Disposes all internal resources of the Notes connection.
*/
public static void shutdown() {
try {
if (factoryInstance != null) {
logger.debug("--> disposing Notes connection <--");
factoryInstance.disposeInstance(true);
}
} catch (Exception e) {
logger.warn("Error al ejecutar dispose: " + e.getCause());
}
}
/*
* newInstance: It is up to the user to remember this instance and to keep
* it as a singleton if needed.
*
* @return new instance of DNotesFactory
*
* @throws DNotesRuntimeException if the instance cannot be created
*/
private static DNotesFactory getFactoryInstance()
throws DNotesRuntimeException {
if (factoryInstance == null) {
ConsoleMonitor monitor = new ConsoleMonitor();
monitor.setLevel(AbstractMonitor.DEBUG);
factoryInstance = DNotesFactory.newInstance(
"de.bea.domingo.proxy.NotesProxyFactory", monitor);
}
return factoryInstance;
}
}
Thanks so much in advance,
Diego
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had tried a similar approach to use a singleton instance of factory before.
I got a problem that it can not serves multi-sessions for different users login concurrently.
Once a user "user1" has logged in, another user "user2" can login by using even invalid user name and password and the session is exactly share with "user1".
Either "user1" or "user2" logged out, the session of other will be also disconnected.
It is a very critical problem for multi-user and security. Finally, I just use one new factory instance for one session to solve the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
Am having a bit of trouble when disposing a domingo notes session from an axis2 web service implementation. The code am using is as follows:
public com.ttdev.ss.CountResponse count(com.ttdev.ss.CountRequest request) throws AxisFault
{
logger.info("Entering CountResponse.");
CountResponse res = new CountResponse();
DNotesFactory factory = null;
DSession session;
DDatabase database;
int count = 0;
try {
factory = DNotesFactory.getInstance();
session = factory.getSession(HOST_NAME, USERNAME, PASSWORD);
database = session.getDatabase(SERVER_NAME, DB);
if ( database.isOpen() ) {
Iterator entries = database.search("Form=\""+ request.getForm() + "\"", null, 0);
while ( entries.hasNext() ) {
entries.next();
count++;
}
res.setOut( count );
}
} catch (DNotesRuntimeException e) {
logger.error(e.getMessage(), e);
throw new AxisFault(e.getMessage());
} catch (DNotesException e) {
logger.error(e.getMessage(), e);
throw new AxisFault(e.getMessage());
} finally {
dispose();
}
logger.info("Exiting CountResponse.");
return res;
}
private void dispose() {
logger.debug("-> Calling DNotesFactory.dispose <-");
try {
DNotesFactory.dispose();
} catch (Exception e) {
logger.warn("Cannot dispose Domingo: " + e.getMessage());
}
}
When performing several simultaneous requests am getting the following error:
[INFO] Entering CountResponse.
[ERROR] java.lang.NullPointerException
org.apache.axis2.AxisFault: java.lang.NullPointerException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.ttdev.ss.SimpleServiceDominoMessageReceiverInOut.invokeBusinessLogic(SimpleServiceDominoMessageReceiverInOut.java:65)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: de.bea.domingo.service.NotesServiceRuntimeException: java.lang.NullPointerException
at de.bea.domingo.service.NotesServiceFactory.disposeInstance(NotesServiceFactory.java:294)
at de.bea.domingo.DNotesFactory.dispose(DNotesFactory.java:452)
at com.ttdev.ss.SimpleServiceDominoSkeleton.dispose(SimpleServiceDominoSkeleton.java:86)
at com.ttdev.ss.SimpleServiceDominoSkeleton.count(SimpleServiceDominoSkeleton.java:75)
at com.ttdev.ss.SimpleServiceDominoMessageReceiverInOut.invokeBusinessLogic(SimpleServiceDominoMessageReceiverInOut.java:48)
... 19 more
Caused by: java.lang.NullPointerException
at de.bea.domingo.service.NotesServiceFactory.invoke(NotesServiceFactory.java:359)
at de.bea.domingo.service.NotesServiceFactory.disposeInstance(NotesServiceFactory.java:290)
... 23 more
[INFO] Exiting CountResponse.
Also when running "tell diiop show users" at the admin console, the sessions remain active.
I would really appreciate some input about the proper way to invoke the dispose method in such environment (tomcat/axis2 accessing domino 7.3 through DIIOP).
Thanks in advance,
Diego
It should be used the method DNotesFactory.newInstance() instead of DNotesFactory.getInstance() for the server base application to obtain a new factory instance each time. The method DNotesFactory.getInstance() just return a singleton instance.
I use the below methods to connect and disconnect domino, as so far it works properly.
Getting a new factory instance:
factory = DNotesFactory.newInstance("de.bea.domingo.proxy.NotesProxyFactory");
Dispose a instance (disconnect):
factory.disposeInstance(true);
I hope it can be helpful.
Hi Moody Ki, thanks so much for your reply, it seems to be working fine now.
I was wondering if I should keep the factory instance into a singleton variable for reuse, do you think this is a good approach?
Now my code looks like this;
public final class DNotesUtil {
/** Singleton instance */
private static DNotesFactory factoryInstance = null;
/*
* Disposes all internal resources of the Notes connection.
*/
public static void shutdown() {
try {
if (factoryInstance != null) {
logger.debug("--> disposing Notes connection <--");
factoryInstance.disposeInstance(true);
}
} catch (Exception e) {
logger.warn("Error al ejecutar dispose: " + e.getCause());
}
}
/*
* newInstance: It is up to the user to remember this instance and to keep
* it as a singleton if needed.
*
* @return new instance of DNotesFactory
*
* @throws DNotesRuntimeException if the instance cannot be created
*/
private static DNotesFactory getFactoryInstance()
throws DNotesRuntimeException {
if (factoryInstance == null) {
ConsoleMonitor monitor = new ConsoleMonitor();
monitor.setLevel(AbstractMonitor.DEBUG);
factoryInstance = DNotesFactory.newInstance(
"de.bea.domingo.proxy.NotesProxyFactory", monitor);
}
return factoryInstance;
}
}
Thanks so much in advance,
Diego
I had tried a similar approach to use a singleton instance of factory before.
I got a problem that it can not serves multi-sessions for different users login concurrently.
Once a user "user1" has logged in, another user "user2" can login by using even invalid user name and password and the session is exactly share with "user1".
Either "user1" or "user2" logged out, the session of other will be also disconnected.
It is a very critical problem for multi-user and security. Finally, I just use one new factory instance for one session to solve the problem.