-1

I've added mysql connector jar file, but class not found exception still arises.

image of added libraries *

dsh
  • 12,037
  • 3
  • 33
  • 51
Jennis Vaishnav
  • 331
  • 7
  • 29
  • 2
    Check you have added the jar in WEB-INF/lib – Sreemat Jan 18 '17 at 12:48
  • 2
    Good practice at SO is giving exception as text, not image – Jacek Cz Jan 18 '17 at 13:41
  • 1
    A tip for asking questions: copy the text of the stack trace and include it directly in the question. It is much much easier to read that way, and in addition will actually work for other people searching for it. Don't take a picture of the text : ). – dsh Jan 18 '17 at 13:43
  • Possible duplicate of [How to install MySQL JDBC driver in Eclipse web project without java.lang.ClassNotFoundexception com.mysql.jdbc.Driver](http://stackoverflow.com/questions/2353141/how-to-install-mysql-jdbc-driver-in-eclipse-web-project-without-java-lang-classn) – Grzegorz Oledzki Jan 20 '17 at 20:32

3 Answers3

2

Your error clearly says that the MySql connector jar is not placed in the correct folder. The correct folder is WEB-INF/lib. So place your jar in this folder.

Draken
  • 3,134
  • 13
  • 34
  • 54
1

You have your eclipse project referencing the mysql library. This allows the compiler, in eclipse, to find the classes when compiling. However, you do not have the library as part of your web app when you publish it to your tomcat server. You need to remove the library from the project, and copy the jar file into your app's WEB-INF/lib directory.

dsh
  • 12,037
  • 3
  • 33
  • 51
1

java.lang.classnotfoundexception com.mysql.jdbc.MySql issued by WebAppClassLoader. This tells that you need to include MySql connector jar in your web path under WEB-INF/lib directory.

fabfas
  • 2,200
  • 1
  • 21
  • 21