Not sure if anyone picked this up before.
sree visu wrote:
Yes!But listeners gets instanitated first all before everything.I called the method which accesses the database in a constructor inside the servlet so that all the objects gets initialized before the application starts.But i just instanitated at the last step ie I used only <load-on-startup> in my web.xml file which is the servlet instantiation which happens after listener,context and filter instantiation in the order which i have specified.But even at that stage the Context object did not exist
Because, you use the constructor. You should never use contructor to initialise your servlet object and/or any listener object. Move your code in the constructor to the overrided init method of the servlet. It should work OK.
Hope it help,
Duc