The above error is what I encountered when customizing the servlet listener, and I'll start with a general description of what I'm going to do (I'm just beginning to learn, if there's a mistake, please correct me):
In order to count the number of site visits, prevent the server restart, the original access is zeroed, so the custom listener class, implement the Servletcontextlistener interface, after the server stopped,
Put the current number of visits to the project under the Count/count.txt, the problem is out here, the Count/count.txt file is not placed in the Webroot directory, so hint null pointing to the exception
Put the file under Webroot and it's OK.
Remark: Beginner small white, please teach more!
Severity: Exception sending context initialized event to listener instance of class [Myjava.myservletcontextlistener] Java.lang. NullPointerException