ServletContext returning NULL
843835Jul 24 2002 — edited Jul 24 2002Hi,
We deployed our application in iPlanet 6.0 on Solaris.
Our report links are routed thru one "intermediate" jsp file for getting the configuration values required for reports.
Configuration values are read and kept in application scope in first time invocation of any report, using the implicit application object.
"application.setAttribute("reports_properties", properties);"
and subsequent call to reports will take the config values from application object.
Application is working fine for past one month and the following exception thrown a day back.
java.lang.NullPointerException
at
com.netscape.server.servlet.platformhttp.PlatformServletContext.getAttribute(Unk
nown Source)
at jsp.APPS.maps.common.intermediate._jspService(intermediate.java:119)
The following is the coding snippet used in the "intermediate" jsp file.
if(application.getAttribute("reports_properties") == null)
{
/* Get Values from Reports.properties file */
synchronized(this)
{
properties = new Properties();
FileInputStream file = new FileInputStream("/Reports.properties");
properties.load(file);
file.close();
application.setAttribute("reports_properties", properties);
readTheProperty = true;
}
}
else
{
/* Get Values from application object */
properties = (Properties) application.getAttribute ("reports_properties");
}
Please clarify me why the NullPointerException thrown.
By any chance "application" object is NULL ?
(ie) application = pageContext.getServletContext(); returns Null which triggered the NullPointerException ?
Thanks in advance for your replies.
Murthy.