I am trying to build a login-registration web app which essentially lets users register on a database and then allows them to log in. I have written all the code, and I am trying to connect my program to my database. Here is the error I receive:
Exception
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoClassDefFoundError: java/sql/Driver
I have added all the Postgres, Tomcat, and SQL connector/driver jar to my classpath and my WEB-INF/lib folders. I am not really sure what else to do. I have tried testing with another class and I am able to connect to my database. I have triple check my connection URL as well. What's wrong?
Thanks!
I know this has nothing to do with Servlets, but I had the same problem with a module application that uses SQLite:
A little puzzling at at first, but I finally figured it out. I just had to add the requires statement for java.sql to the
module-info.java:(The requires sqlite.jdbc was already in there, added it above just for clarity)