V
vic
Hello All,
I am having this issue with my Servlet, cant seem to understand. I
have the snippet of the servlet below whihch forwards the request to a
jsp based on what the method condition returns. The servlet however
does forward to the appropriate jsp but then gives a NUll pointer
exception.
Here is the servlet snippet
public void doPost (HttpServletRequest request, HttpServletResponse
response) throws ServletException, java.io.IOException {
ausername = request.getParameter("ausername");
apassword = request.getParameter("apassword");
try {
authenticate(ausername, apassword); //returns true if user is
valid and else false
if(aReturn == true) {
this.getServletContext().getRequestDispatcher("/gototrue.jsp").forward(request,
response);
}
else {
this.getServletContext().getRequestDispatcher("/gotofalse.jsp").forward(request,
response);
}
}
catch (ServletException se) {
}
Here is the error log i get:
<Error> <HTTP> <[WebAppServletContext(1531469,myapp,/
myapp)] Servlet failed with Exception
java.lang.NullPointerException
at csf.webcntrl.HTTPRMIAdapter.doPost(HTTPRMIAdapter.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Am i missing something, session , ServletContext() or something on
those lines.
Any help is appreciated
I am having this issue with my Servlet, cant seem to understand. I
have the snippet of the servlet below whihch forwards the request to a
jsp based on what the method condition returns. The servlet however
does forward to the appropriate jsp but then gives a NUll pointer
exception.
Here is the servlet snippet
public void doPost (HttpServletRequest request, HttpServletResponse
response) throws ServletException, java.io.IOException {
ausername = request.getParameter("ausername");
apassword = request.getParameter("apassword");
try {
authenticate(ausername, apassword); //returns true if user is
valid and else false
if(aReturn == true) {
this.getServletContext().getRequestDispatcher("/gototrue.jsp").forward(request,
response);
}
else {
this.getServletContext().getRequestDispatcher("/gotofalse.jsp").forward(request,
response);
}
}
catch (ServletException se) {
}
Here is the error log i get:
<Error> <HTTP> <[WebAppServletContext(1531469,myapp,/
myapp)] Servlet failed with Exception
java.lang.NullPointerException
at csf.webcntrl.HTTPRMIAdapter.doPost(HTTPRMIAdapter.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:262)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Am i missing something, session , ServletContext() or something on
those lines.
Any help is appreciated