Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Calling a Java Script Library from Lotus Script Agent
Feedback Type: Question
Product Area: Domino Designer on Eclipse (DDE)
Technical Area: Error Message
Platform: Windows 2003 server
Release: 8.5
Reproducible: Always

Hi,

I am hoping someone can help me with a problem I am stumped on.

I have a Lotus Script Agent from which I call a Java Script Library. When executing the Java code there is a null pointer exception and the code bombs out.

I can put the Java Script Library into it's own agent and can run it without any problems.

It seems to be failing when called from the agent on:

Session session = getSession();


This is the call to the Java Script Library from the Lotus Script agent:

Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myObject As JavaObject
Dim myMethod As JavaMethod
Dim success As Boolean

Set mySession = New JavaSession()
Set myClass = mySession.GetClass("HWURLCommand")
Set myMethod = myClass.GetMethod("NotesMain","()V")
Set myObject = myClass.CreateObject()

success = 999
success = myMethod.Invoke(myObject)

If success Then
'Do stuff
Else
'error occurred
End If


This is the Java Script Library:

import lotus.domino.*;
import java.io.*;
import java.net.*;

public class HWURLCommand extends AgentBase {

public void NotesMain(String x) {

try {
System.out.println("*** Started HWURLCommand ***");
Session session = getSession();
System.out.println("1");
AgentContext agentContext = session.getAgentContext();
System.out.println("2");
Database db = agentContext.getCurrentDatabase();
System.out.println("Title:\t\t" + db.getTitle());
String dbFilename = db.getFileName();
System.out.println("File name:\t" + db.getFileName());

//Do Stuff here
}
}
}

I get *** Started HWURLCommand ** to print out on the console and then get the following errors:

Agent Manager: Agent error: java.lang.NullPointerException
Agent Manager: Agent error: at HWURLCommand.NotesMain(HWURLCommand.java:12)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
Agent Manager: Agent error: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
Agent Manager: Agent error: at java.lang.reflect.Method.invoke(Method.java:391)
Agent Manager: Agent error: at lotus.domino.JavaConnectInvoker.invoke(Unknown Source)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
Agent Manager: Agent error: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
Agent Manager: Agent error: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
Agent Manager: Agent error: at java.lang.reflect.Method.invoke(Method.java:391)
13/07/2009 05:57:58 PM Agent Manager: Agent error: at lotus.domino.JavaConnectLoader.invoke(Unknown Source)

This is exception message from the Lotus Script Agent:

Agent Manager: Agent printing: ***HW agent finished in Exception ***
Agent Manager: Agent message: Error in HW Invalid use of null on line 17


Any help would be appreciated.

Thanks.


Feedback number WEBB7TX3T7 created by ~Hank Reachekobu on 07/14/2009

Status: Open
Comments:





Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS