PostgreSQL connection in Java Servlet to Retrieve Information from the DB. Getting Error

前端 未结 3 1003
一生所求
一生所求 2021-01-07 07:21

I am having difficulty with getting this work. I can connect to the database without problem, however I can not make it show me the html page. It does not run.



        
3条回答
  •  情深已故
    2021-01-07 07:55

    Seem you did't add Postgresql JDBC driver into classpath, as the following error suggest:

    javax.servlet.ServletException: Class not found Error
    

    Which is origin from:

    throw new ServletException("Class not found Error");
    

    You can download Postgresql JDBC driver and put in PROJECT/WEB-INF/lib folder.

    Suggestion

    One suggestion, your exception handling is wrong, you should change

    throw new ServletException("Class not found Error");
    

    to

    throw new ServletException("Class not found Error", e);
    

提交回复
热议问题