Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unexpected exception

 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey folks, from time to time one of my servlets throws a nullpointerexception with this tree:

i can't understand from the exception message if this is a problem of code, but in any case the exception is thrown from time to time and not always...
yeh, the servlet runs on tomcat 4.0.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you find when you look up line 673 in source code for the StandardWrapper class, org.apache.catalina.core package? That might give you a clue.
Bill
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exam all the log files in logs folder you may find more useful debug info.
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, i'll take a look on the log files later. i can't see the 673 line of the source code. it's one of the tomcat classes, and i don't have the source code.
i found out that this exception is thrown if i recompile a servlet and try to run it again without restarting tomcat.
so, at least i know how to deal with it now
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found out that this exception is thrown if i recompile a servlet and try to run it again without restarting tomcat

I suspect that your servlet uses other objects and does not handle objects creation properly. When a servlet is refreshed, other servlet/classes may also get destroyed.
Do you store objects in session?
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeh, it uses sessions and db connectivity, but as you see the exception is not thrown by a code
itself, but by tomcat...
in any case, in production noone will recompile the servlet , and for sure not when it's running.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well then - download the source code - its free and even fairly well annotated.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic