I developed my enterprise application using Java EE. This uses JDBC for mysql connection. The project works fine when its run from the intellij idea IDE. But after i deployed it with the same version of tomcat, JDBC connector and all the other libraries as used during development. The login page is browsed but as soon i login after providing all the credentials, it throws out an error in form of exception along with 500 error which i believe is due to connection failure to mysql. The error message is:
java.lang.NullPointerException
utils.DatabaseConnection.getPreparedStatement(DatabaseConnection.java:34)
services.UserService.getUser(UserService.java:31)
controller.SessionServlet.doPost(SessionServlet.java:30)
javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
This was because Java could not communicate with mysql. This led null pointer for a variable related to username and password. It was due to misconfiguration for database connection. I entered wrong informations.