• Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContextListener

 
Shanika Wijerathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used the ServletContextListener with out implementing the contextDestroyed() method (means i didnt write any thing inside the body just contextDestroyed(){}) and my web application worcks well.. but i checked the log and it shows a null pointer Exception @ contextDestroyed method
So can some one tell me what is the reason for getting a nullpointer exception there.. and there is nothing wrong with codings.. i checked them again and again

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the stack trace show definitively that the NPE is coming from your listener?
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried out the same but i don't get a NPE
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No chance to get a null pointer exception.check the stack trace for finding the root cause of the exception.

What happens when you do not use this listener ?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
contextDestroyed method


Since you are not doing anything with context destroyed you should not get any errors. Can you post the stack trace here. What is your listener class called ?
 
Shanika Wijerathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i got it!! it works that was a little mistake of mine n i found it. thanks alot for evry one who helped me with posting replies and for consuming your time for this. And i learnt alot with this error.. thanks again im new here and im preparing for SCWCD exam hope i didn't ask a dump question thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!