• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with ServletContextListener

 
Divya ram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a small tutorial described in HFJS on page 169 is giving me the obvious exception nullpointerexception.And i am not able to debug though i have understood the concept in the book.getAttribute() and setAttribute() have same string names and web.xml has all entries for servlet servlet mappings listener and context-param

can anyone help me out..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's going to be difficult to help without any hints. Could you please post the NullPointerException stack trace ?
 
Divya ram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i could find out the solution as it was my own mistake.
Instead of placing the code in contextInitialized()[method in MyServletContextListener.java] i wrote it in contextDestroyed().
After correction it runs fine.

Thanks for the reply..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic