We get this error when we are trying to access any object which value is null or which is pointing to null.
In my case, I have created a new user in data base using which my java web application connects to the database.
I just created and tried to access the application which throws the exception.
Restarting web server resolved the issue.
Visit articles page of the website learningmela.com for more details.