• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null pointer exception ?

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!,
I am using a servlet which simply
checks whether the session is
new.. if it is new, then send it to another page using redirect()
this is the error which it is showing
*************
Document moved
This document has moved here.
Error: 500
Location: /netzone/addfrm
Internal Servlet Error:
java.lang.NullPointerException
at horse.addfrm.doGet(addfrm.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at ngasi.a.a.n.a(Unknown Source)
at ezj.b.e.run(Unknown Source)
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell without seeing the code for your "addfrm" class. I know the problem occurs at line 36, though!
Could you post the doGet method, and any others it calls so we can have a look? Don't forget to put code examples iside UBB CODE tags (for details, see the "UBB Code is ON" link to the left when you create a message).
 
Rama Chandra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason for nullPointerException may be due to calling a method on null session object.

You may be checking session.isNew() on a null session object.
Firt you check weather it in null or nor and then check weather it is new or old.
 
bhawna
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
to solve your problem
put the null pointer exception in throws clause.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic