Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.NullPointerException

Status
Not open for further replies.

pdotd

Programmer
Jun 15, 2004
29
CA
when i run my jsp script i get this error posting:

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:346)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


root cause

java.lang.NullPointerException
bean.OfficeRegBean.getData(OfficeRegBean.java:209)
bean.OfficeRegBean.getEmployees(OfficeRegBean.java:161)
org.apache.jsp.employees_jsp._jspService(employees_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
OfficeController.directTo(OfficeController.java:203)
OfficeController.doGet(OfficeController.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


now here is my getEmployees method:


public ResultSet getEmployees()
{
query = "SELECT * FROM employees";

return getData(query);
}

And here is my getData method:

public ResultSet getData(String query)
{
try
{

if (trace)
{
connectToDB();
}
// Create the statement
Statement mystatement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

// Create the Resultset
return mystatement.executeQuery(query) ;


}
catch (SQLException sqle)
{
//System.out.println("getData: " + sqle.getMessage());

return null;
}
}

any help would be greatly apprecaited to why i get this error or how it can be fixed

thanks
 
Why are you starting a new thread when you have another active thread on the same code ?

thread269-886918

--------------------------------------------------
Free Database Connection Pooling Software
 
i guess it would make sense to post in the original thread,

sorry about that.


pdotd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top