• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error - HTTP 505 - Status report

 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am now trying to recreate the same files in another folder. But, when I run my jsp which is to process the data and post it up to Ms access table, it gives me the following message. Hope someone can advise how to rectify the problem. Million Thanks.


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /processAddMember.jsp at line 27

24:
25:
26: //collect information from the form data
27: strFullName = request.getParameter("txtFullName").trim();
28: strEmail = request.getParameter("txtEmail").trim();
29: strAddress = request.getParameter("txtAddress").trim();
30: strNRIC = request.getParameter("txtNRIC").trim();


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


root cause

java.lang.NullPointerException
org.apache.jsp.processAddMember_jsp._jspService(processAddMember_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
27: strFullName = request.getParameter("txtFullName").trim();


Will throw a NPE if getParameter() returns null because there is no parameter by that name or if the request reference is null.

Im betting on the first, so you need to code defensively.

Bill
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As reiterated by William, either check for null values on the client-side (javascript) or in your servlet/jsp; e.g.

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles 'King wrote:As reiterated by William, either check for null values on the client-side (javascript) or in your servlet/jsp; e.g.



Or perhaps:

I mean, why call req.getParameter() twice?
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Or perhaps:

I mean, why call req.getParameter() twice?


My response to the OP was meant to simplify the answer for him. For instance, semantically your code could be refactored:
 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys. Your replies are just too difficult to comprehend.

Due to urgency, I've tried to create new folder for the project.

Thanks anyway.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tangara goh wrote:Thank you guys. Your replies are just too difficult to comprehend.

Due to urgency, I've tried to create new folder for the project.

Thanks anyway.


What don't you understand? If you attempt to dereference a null variable, you'll get a NullPointerException. Your error was showing that your code was dereferencing a null variable. This is Java 101 (actually, the same is true in many programming languages).

Best Regards,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic