Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home Problem with documentcontext in Java Agent
Navigation
 

Problem with documentcontext in Java Agent

by Andrea Baglioni — last modified Jun 01, 2010 12:00 PM
Filed Under:

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!

Document Actions
Powered by DISQUS comment system