I’ve got a Lotusscript agent that calls a java agent with agent.run. The agent is importing XML into docs. Running the agents locally works great, running the agents on a schedule on the server produces errors. In the local notes.ini and in the Domino’s notes.ini I have:JavaUserClasses=d:\lotus\notes\xml4j.jar;d:\lotus\notes\lotusxsl.jar
Any ideas?
02/17/2005 05:43:21 AM AMgr: Agent (‘ImportXMLGetFile’ in ‘aptreg.nsf’) printing: aptdemo2.rdf
02/17/2005 05:43:21 AM JVM: Java Virtual Machine initialized.
02/17/2005 05:43:22 AM Agent error: java.lang.NullPointerException
02/17/2005 05:43:22 AM Agent error: at JavaAgent.ImportRss(JavaAgent.java:149)
02/17/2005 05:43:22 AM Agent error: at JavaAgent.NotesMain(JavaAgent.java:24)
02/17/2005 05:43:22 AM Agent error: at lotus.domino.AgentBase.runNotes(Unknown Source)
02/17/2005 05:43:22 AM Agent error: at lotus.domino.NotesThread.run(NotesThread.java:215)
I too found my Java agent bombing with a java.lang.NullPointerException when it ran on the server but not locally. It wasn’t a configuration issue, as the agent worked fine before I made some code updates.
My problem turned out to be a coding error, but why it worked on my local PC perplexes me. I am sure you are familiar with the fact that in @formula language or LotusScript, if you attempt to retrieve the value of a field in a Notes doc that either A) does not exist or B) is “”, you get a return value of “” and life is good.
I learned that Java flips out in this seemingly ordinary occurrence. The Document getItemValueString() method returns null in both those cases and generates a NullPointerException during any attempt to compare a null variable to anything other than null. Therefore, I had to check the return value of the getItemValueString() method and reset it before proceeding. I don’t know if you are doing anything like this in your code, but here are my examples…
Example 1: This code generates the NullPointerException error.
Example 2: This code catches the ‘null’ and avoids the above error by resetting the myFieldValue variable to a value equivalent to “” (in my case, the string “0” works).
Anyway, what’s null at line 149 of the ImportRss method? Is it the XML file your trying to import? If so, is the file path valid when running on the server?