Personal tools
You are here: Home 2010 June 01 Problem with documentcontext in Java Agent

Jun 01, 2010

Problem with documentcontext in Java Agent

In a Java agent, If you are accessing your document via agentContext.getDocumentContext(), I've found a problem in managing attachment with extractFile method

Error found is "a database handle to a remote database cannot be used by more than one thread"

This is my workaround.

Instead of doing:

AgentContext agentContext = session.getAgentContext();
lotus.domino.Document inDoc = agentContext.getDocumentContext();
Database db = agentContext.getCurrentDatabase();

 try doing this : 

AgentContext agentContext = session.getAgentContext();
lotus.domino.Document inDoc = agentContext.getDocumentContext();
String unid = inDoc.getUniversalID();
inDoc.recycle();
Database db = agentContext.getCurrentDatabase();
lotus.domino.Document inDoc2 = db.getDocumentByUNID( unid );

Now works!

Filed under: ,
comments powered by Disqus