• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error - HTTP 505 - Status report

 
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
reply
    Bookmark Topic Watch Topic
  • New Topic