Adding a null check, failure happens when there the right databse is not there.
More null checks in LoginServlet.java