Reputation: 39
I have started jsp servlet application with Xampp Server,
In which I have dbconnection.java
and LoginValidator.java
(servlet) files.
I'm getting an error while trying to access the database from servlet (LoginValidator.java
).
It is getting the following error:
Class Not found Exception : com.mysql.jdbc.Driver
I have imported the mysql-connector-java-5.1.18-bin.jar
. I have searched a lot but could not find the solution.
Upvotes: 3
Views: 172
Reputation: 339
Where the mysql-connector-java-5.1.18-bin.jar is in your project? And is mysql-connector-java-5.1.18-bin.jar in classpath project?
See in you application on server if mysql-connector-java-5.1.18-bin.jar is deployed.
Upvotes: 1
Reputation: 8842
try to put your connector jar into /WEB-INF/lib/ directory of your application. If it doesn't work then try this ugly trick: put your mysql-connector jar into \xampp\tomcat\lib\ directory. You may have incorrectly imported connector jar so it is not on the classpath.
Upvotes: 0
Reputation: 15644
You have to put mysql-connector-java-5.1.18-bin.jar
file inside the folder:
YOUR_WEBAPPS_FOLDER/YOUR_WEBAPP/WEB-INF/lib/
so that it will be available in the classpath when your servlet is compiled by the web container.
Upvotes: 0