Hi I am using Resin1.2.3 engine to run my servlet and mysql database with mysql-jdbc driver to connect my servlet with database ....but it gives me null pointer exception when I run my servlet .... 500 servlet exception java.lang.NullPointerException.... I hope many of you might have face this problem....so please help me in fixing this problem I am copying my servlet.... public class Firstdb extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { Connection con = null; Statement stmt = null; ResultSet rs = null; res.setContentType("text/html"); PrintWriter out= res.getWriter(); try { //load driver Class.forName("org.gjt.mm.mysql.Driver").newInstance(); //get connection con = DriverManager.getConnection("jdbc:mysql://localhost:8080/test"); //create statement stmt = con.createStatement(); //execute an sql query rs = stmt.executeQuery("SELECT * FROM employee"); out.println("<HTML><HEAD><TITLE>PHONE BOOK</TITLE></HEAD>"); out.println("BODY"); out.println("<UL>"); while(rs.next()) { out.println("<LI>"+rs.getString(1)+" " + rs.getString(2) + " " +rs.getString(3)); } out.println("</UL>"); out.println("</BODY></HTML>"); } catch(ClassNotFoundException e) { out.println("couldn't load database driver:" +e.getMessage()); } catch(SQLException e) { out.println("SQLException caught:"+e.getMessage()); } catch(Exception e) { out.println("unable to load driver"); } try { // rs.close(); // stmt.close(); con.close(); } catch (SQLException ignored) { } } } Thanks Scott Decosta