Solving Http Status 500 Servlet Exeution threw an exeption for Simple Login Servlet : /* hi here is the code for simple login servlet in eclips which checks username and password  from the existing table of database and  take it to home page if exists or send to login page. When I run it on server and put information in login page it shows following error. can you help for that please. thank you. */

**[strong text][1]**
ERROR TO SOLVE


        HTTP Status 500 - Servlet execution threw an exception

        ------------------------------------------------------------------------        --------

        type Exception report

        message Servlet execution threw an exception

        description The server encountered an internal error that prevented it   from fulfilling this request.

        exception 

        javax.servlet.ServletException: Servlet execution threw an exception


        root cause 


        java.lang.Error: Unresolved compilation problem: 
	
        Unreachable catch block for ClassNotFoundException. This exception is   never thrown from the try statement body

	    com.loginapps.servlets.LoginServlet.doGet(LoginServlet.java:90)
	    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)







CODING 


        package com.loginapps.servlets;

        import java.io.IOException;
        import java.sql.Connection;
        import java.sql.DriverManager;
        import java.sql.SQLException;
        import java.sql.ResultSet;
        import java.sql.PreparedStatement;

        import javax.servlet.ServletConfig;
        import javax.servlet.ServletException;
        import javax.servlet.http.HttpServlet;
        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;
        import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class LoginServlet
 * @param <con>
 */
        
        public class LoginServlet extends HttpServlet {
	    private static final long serialVersionUID = 1L;
	
	
	    Connection con;
	    PreparedStatement pst;
	
	    public void init(ServletConfig config) throws ServletException 
	    {
		String dname = config.getInitParameter("drivername");
		String uname = config.getInitParameter("username");
		
		System.out.println(dname);
		System.out.println(uname);
		
		try
		{
			Class.forName(dname);
			con =   DriverManager.getConnection("jdbc:mysql://localhost:3306/logindb",uname,"");
		}
		
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		
		catch(ClassNotFoundException e)
		{
			e.printStackTrace();
		}	
	
	 }
	
	
	
        protected void doGet(HttpServletRequest request, HttpServletResponse  response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	
	
	    HttpSession session = request.getSession();
	   
        String uname = request.getParameter("txtuname");
		String pwd = request.getParameter("txtpwd");
		
		session.setAttribute("username",uname);
		
		
         try
         {
	     pst = con.prepareStatement("select * from users where username = ? and  password = ?");
	     pst.setString(1,uname);
	     pst.setString(2,pwd);
	 
	     ResultSet rs = pst.executeQuery();
	     if(rs.next())
	     {
		 response.sendRedirect("home.jsp");
	     }
	     else
	     {
		 response.sendRedirect("login.html");
	     }
      }
	
        catch(SQLException e)
        {
	    e.printStackTrace();
        }
  
        catch(ClassNotFoundException e)
        {
	    e.printStackTrace();
        }
    
     }
	
	

 
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		doGet(request, response);
	    }
      }

