1
votes

I have bumped into a weird problem in feature that works well on all other installations, but not for one particular client.

The "feature" involves an xpage with code in beforerenderrespons that picks up an uploaded file, gets filename etc and creates a context document. The context document is then passed as parameter to a java agent which process the file.

The java agent is set to Run as web user and has Allow restricted operations. As I said - it works in all installations at other clients, but fails all of sudden on one installation.

The only error message I get from beforerenderrespons event is "Error:Exception occurred calling method NotesAgent.runWithDocumentContext(lotus.domino.local.Document) null". I have confirmed that the agent is found but it never gets called. I have also confirmed that the context document also exists. The server console says nada.

I have tested calling the agent with different run methods as in agent.run() but it does not make a difference.

Now to the weird stuff - if I call a java agent that does not include a scriptlibrary it works! But as soon as I add a script library to the agent I get the error above.

Why is that? Any help or clue appreciated. It feels like I have missed a security setting somewhere. The server doc includes the agent signer in "Sign agents to run on behalf of someone else", "Sign or run unrestricted methods and operations" and "Sign or run restricted LotusScript/Java agents"

edit: Tested using a "pass-thru" agent that calls my original java agent that contains script libraries and that works! The pass-thru agent doesnt contain any scriptlibrary and simply calls my java agent and passes on the context document.

Even so - I still want to know why calling a java agent directy fails if it contains a script library.

/Katarina

2
That error reminds you the object you call the method on is null - so variable with agent is probably not initialized. May be the ACL/permission of the signer of XP.Frantisek Kossuth
I have verified that the agent is not null by printing agent.getName() and it returns correct agent name. Also verified that context document is not null by printing values from docKatarina Stubberud

2 Answers

0
votes

One possiblity is the server version. That would explain why it works in some installations and not another. runWithDocumentContext() was only added in 8.5.2 http://blog.nashcom.de/nashcomblog.nsf/dx/passing-a-document-to-an-agent-without-saving-it-first.htm

0
votes

Since your agent is Java anyway, you can save the trouble of spinning up a new class loader and jvm environment. Move the code into a jar and call it directly from the XPage. I can't think of a good reason to use the agent (because it was there isn't a good reason in this case)