Hi, I have use java agent on local server It work well but at server database it show me above error my code is
import lotus.domino.*;
import java.util.Vector;
import java.util.Enumeration;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Document doc = agentContext.getDocumentContext();
RichTextItem body = (RichTextItem) doc.getFirstItem("Body");
Vector v = body.getEmbeddedObjects();
Enumeration e = v.elements();
while (e.hasMoreElements()) {
EmbeddedObject eo = (EmbeddedObject)e.nextElement();
System.out.println("\t" + eo.getName());
eo.extractFile( "c:\\extracts\\" +eo.getSource());
}
} catch(NotesException e) {
System.out.println(e.id + " " + e.text);
e.printStackTrace();
}
}
}
Subject: About :- 4005 Notes error: A database handle to a remote database cannot be used by more than one thread.
Hi Ajit,
also it is rather late I think I ran into the same issue today.
I had an Agent that was triggered from view with a selected document. It is written in Java and does something before it tries to embedded some files from local drive. When that embed operation starts it client throws same Java messages according concurrent use of database handles.
The reason is (I think) a problem with handling of documents addressed through getDocumentContext().
How did I fix it:
My intention was to get the selected document. So I switched from getDocumentContext() to agentContext.getUnprocessedDocuments() and processed just first document (if any) in collection.
That works just fine without any error.
Hope that helps,
Mike
Subject: RE: About :- 4005 Notes error: A database handle to a remote database cannot be used by more than one thread.
Hi Mike,
Thanks Man. This issue surely ruined my evening...
That was brilliant fix that you have posted here⦠I worked very fine
Thanks a Lot 