Tuesday, February 23, 2010

Cannot create automation object when we use RunOnserver

I had situation where my agent1 (I run it on server like agent1.RunOnserver).
Agent1 create OLE object (WinHttp.WinHttpRequest or MSXML2.ServerXMLHTTP or it could be another OLE object without Quit/Exit method). As these objects do not have Quit/Exit method Domino continued to keep these objects in memory(?). So next time when I run agent I gave an error:

"Cannot create automation object"

I found workaround for this. It is strange, but it works.

I created new agent and called it on server instead of agent1 (f.x. agentNew.RunOnServer) This new agent called agent1 locally (f.x. Call agent1.Run). There is also article on IBM about solution for error Cannot create automation object
Funny, right?

2 comments :

BP said...

Yeah, a big pain. The other option is to have a web agent call a server local. Interestingly, if you shut down all instances of notes after .RunOnServer, you can restart and do it all again. Like it waits for the session to end before cleaning up, or something?

cntrydad said...

This is a longstanding problem when running agents from the notes client using run-on-server. The easiest workaround is to logoff (Clear Private user information) (CTL+F5) then run the agent again. A real pain. It's been a problem since R6 (possibly R5, but I can't remember for sure).