I get the below error message when I try to run the testing class below that. I googled the exception and read:
This exception is thrown when no initial context implementation can be created. The policy of how an initial context implementation is selected is described in the documentation of the InitialContext class.
// then I read this: http://publib.boulder.ibm.com/infocenter/adiehelp/index.jsp?topic=/com.sun.api.doc/javax/naming/NoInitialContextException.html
This exception can be thrown during any interaction with the InitialContext, not only when the InitialContext is constructed. For example, the implementation of the initial context might lazily retrieve the context only when actual methods are invoked on it.
I really dont understand what I read. Could someone please explain what my issue is and why it is occurring and how I could fix it.
Thank you in advance,
Crystal
Naming error: javax.naming.NoInitialContextException: Need to specify class name
in environment or system property, or as an applet parameter, or in an applicat
ion resource file: java.naming.factory.initial
Exception in thread "main" java.lang.NullPointerException
at notifier.notifierMethod.SiteManager(notifierMethod.java:230)
at notifier.testing.main(testing.java:22)
testing.java
...
class testing {
public static void main(String[] args) {
//Display "Hello World!"
System.out.println("Hello World!");
notifier notifierInformation = new notifier();
//session.setAttribute("notifier", notifierInformation);
//get db connection
database.DataFactory dbf = database.DataFactory.getDataFactory(database.DataFactory.sybase);
notifierInterface notifierDB = dbf.getNotifierInterface();
notifier sitemanager = notifierDB.SiteManager(newID, notifierInformation); // LINE 22
}
}
notifierMethod
...
public notifier SiteManager(String newID, notifier notifierInformation) {
try {
ArrayList sitemgrList = new ArrayList();
this.conn = database.SybaseDAO.grabConnection();
cs = conn.prepareCall("{call mt."+newID+"_Notifier_SiteManager()}"); // LINE 230
rs = cs.executeQuery();
while(rs.next()) {
String owner = rs.getString(1);
sitemgrList.add(owner);
}
notifierInformation.setSitemgrList(sitemgrList);
...
}