• 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

prb from Hemant Deshmukh...

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys
i got this program from hemant deshmukh / chapter 04
it has 2 servlets LoginServlet & AccountServlet .. html request file Login.html & web .xml

here is LoginServlet




AccountServlet





Login.html





web.xml




and here is the error - 500


type Exception report

message

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

exception

java.lang.NullPointerException
AccountServlet.doPost(AccountServlet.java:30)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
LoginServlet.doPost(LoginServlet.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


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


i dont know what the prb is ... can anybody pls help me ?

Thankx in advance
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in AccountServlet

in init() method .. its changed to
public void init(){
data.put("ann",new String[]{"1/2/04:1000.00","3/3/04: 6000.00","4/4/04: 30000.00"});
data.put("john",new String[]{"1/2/04:100.00","3/3/04: 9000.00","4/4/04: 4000.00"});
data.put("mary",new String[]{"1/2/04:100.00","3/3/04: 6000.00","4/4/04: 7000.00"});
}

even then i'm getting the same prb ..error 500
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I think I remember this error... I think in "AccountServlet.java" - just try changing
String[] records=(String[]) data.get("userid");
to
String[] records=(String[]) data.get(userid);

ie. no quotes around "userid"
There should be errata posted for Deshmukh book too. Just search the web.

Thanks,
Jayanthi.
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx alot Jayanthi... it worked ...
 
reply
    Bookmark Topic Watch Topic
  • New Topic