This is what I think is going on and how I suggest you debug it: The NullPointerException you see is because your [DbConnection.getconnection()] call is returning null. You see that message in your browser because [out] in the JSP page is set up to "write there". In your [DbConnection.getconnection()] method, you set the connection to null. Then in your try block, an exception happens, you catch and print that exception, and return the null. You don't see the exception because you use [system.out.println] and that write to the stdout of the JVM Catalina is using. Usually Tomcat setups redirect that to a log file. There are 2 things in your [try] block that are likely to fail with an exception. The first is a problem coming from the classloader when you use it to load the driver. The second is when you connect to the database. To understand what is going wrong, seeing what exception you received would be helpful. To see that, you have to look in the catalina logs to see if the exception message you printed to stdout was redirected to there. Or, better, change your method to NOT swallow and print the exception to stdout. For your debugging, either don't catch the exception, or if you do want to print it, rethrow it after. Then the root cause exception, and not just a null, will be trapped and handled in the try/catch block in your JSP page, and you can see it on the browser.