I have a Java package that holds utilities, one of which accesses a Notes database. When I first use this class (called from a session scoped bean), which is static and returns a boolean it always seems to throw an exception on accessing the database object. Subsequent calls work.
My code starts off as follows and throws the exception on either the line to access the database or the line that checks if it is open. I saw some folks have posted issues with static classes. Is that the issue or is it something else?
boolean rtn = false;
try {
Session session = ExtLibUtil.getCurrentSessionAsSigner();
if (session.isValid() == false){
DebugToolbarBean.get().info("Session is not valid");
} else if (session == null){
DebugToolbarBean.get().info("session is null");
} else{
DebugToolbarBean.get().info("session is good");
}
DebugToolbarBean.get().info("Session server is " + session.getServerName());
DebugToolbarBean.get().info("session" + session.getServerName());
ConfigBean configBean = (ConfigBean) ExtLibUtil.resolveVariable(FacesContext.getCurrentInstance(), "configBean");
String nabDbname = (String) configBean.getValue("UserDominoDirectoryPath");
DebugToolbarBean.get().info("nab db is " + nabDbname);**
Database nabDb = session.getDatabase(session.getServerName(), nabDbname , false);
if (nabDb.isOpen()){
In the debug tool bar I get:
18:01:29 Error in validatePhase1java.lang.RuntimeException: Error in checkAddressBook: NotesException: Object has been removed or recycled
18:01:29 error in checkAddressBook:dBar says NotesException: Object has been removed or recycled
18:01:29 nab db is Development\External\Cascade\cascweb3final.nsf
18:01:29 sessionCN=Dev01/O=TSPSDev
18:01:29 Session server is CN=Dev01/O=TSPSDev
18:01:29 session is good
18:01:29 Starting
The rest of the code (that throws the exception is)
} catch (Exception e) {
rtn = false;
DebugToolbarBean.get().info("error in checkAddressBook:dBar " + e.toString() );
e.printStackTrace();
throw new RuntimeException( "Error in checkAddressBook: " + e.toString());
}
checkAddressBook
. It may give a pointer to why the error occurs. I had a lot of these where the sessionScoped bean was losing Domino objects in the past. – Rob Mason