classNotFound Exception when using JDBC for MYSQL on Tomcat in eclipse

后端 未结 4 1739
旧巷少年郎
旧巷少年郎 2021-01-17 02:03

This seems to be a common problem, but I could not find a working solution. I\'ve looked through dozens of thread and have been working with my teacher. I am trying to conn

相关标签:
4条回答
  • 2021-01-17 02:41

    Putting the MySQL-connector-java-5.1.6.jar in the Tomcat/lib directory finally worked for me. Shouldn't have to do this so I suspect my Tomcat installation isn't optimum and deploying the war file might be problematic

    0 讨论(0)
  • 2021-01-17 02:52

    modify 'common.loader' property in the 'catalina.properties' file in the tomcat 'conf' folder as shown below

    common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
    

    Also add 'mysql-connector-java-5.0.8-bin.jar' in the tomcat 'lib' folder

    0 讨论(0)
  • 2021-01-17 02:59

    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    You missing MySQL driver library. Since, you are using Mysql database, make sure you have included mysql-connector-java.

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.8-dmr</version>
    </dependency>
    
    0 讨论(0)
  • 2021-01-17 03:05

    Version Mismatch could cause this error. I myself was stuck in this error for days. Please check the version of jdbc connector. Latest connectors require java 1.8. In my case my tomcat version didn't support the connector version i added so please check for that also.

    PS : Tomcat - 8.0.32 ; mysql-connector - 5.1.30 with java 1.7 works (Y)

    0 讨论(0)
提交回复
热议问题