Agent, Error cleaning up agent threads…I have this agent which is calling an EJB.It works fine the first time …when it exits out it gives me an error “Error cleaning up agent threads”.I have checked for active threads before exiting out…
I am using Domino6.02 and WAS5.
import lotus.domino.*;
import hennepin.co.srt.ITGroup;
import hennepin.co.srt.SRTHelper;
import hennepin.co.srt.SRTHelperHome;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.ibm.websphere.naming.WsnInitialContextFactory;
import com.ibm.websphere.naming.*;
import javax.naming.*;
import java.util.Hashtable;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// out("Printing property: " + System.getProperties()); //ty(“java.class.path”));
testEJB();
} catch(Exception e) {
e.printStackTrace();
}
}
/**
* Creates connection to testEJB and executes
* a method on the ejb
*/
public void testEJB() {
out("Entered testEJB method");
com.ibm.websphere.naming.WsnInitialContextFactory f = new com.ibm.websphere.naming.WsnInitialContextFactory();
out("after com.ibm.websphere.naming.WsnInitialContextFactory;");
Properties prop = new Properties();
prop.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory" );
prop.put("java.naming.provider.url", "iiop://....");
Hashtable ht2=new Hashtable();
ht2.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory" );
ht2.put("java.naming.provider.url", "iiop://....");
try {
// Get a naming context
out("before getting context");
javax.naming.InitialContext initialContext = new javax.naming.InitialContext(ht2);
out("got initial context");
// Get a reference to Bean
Object obj = initialContext.lookup("/lookup....");
out("looked up SRTHelper");
SRTHelperHome srtHelperHome = (SRTHelperHome)
javax.rmi.PortableRemoteObject.narrow(obj, SRTHelperHome.class);
out("got srtHelperHome");
// Create an Posting object from the Home interface
SRTHelper srtHelper = srtHelperHome.create();
out("got srtHelper");
// call the authenticate method
ITGroup itGroup = srtHelper.getGroups();
out("got group");
try {
for (int i = 0; ; i++) {
out("unit number: " + itGroup.getUNIT_NO(i));
out("unit name: " + itGroup.getUNIT_NM(i));
}
} catch (Exception e) {
}
} catch (RemoteException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void out(String s) {
System.out.println(s);
}
}