简体   繁体   English

Spring Tool Suite找不到JDBC驱动程序类

[英]Spring Tool Suite can't find JDBC Driver class

During the project building, i received an error: 在项目建设期间,我收到一个错误:

Could not load JDBC driver class [com.mysql.jdbc.Driver] 无法加载JDBC驱动程序类[com.mysql.jdbc.Driver]

I have jdbc connector attached to my project (mysql-connector-java-5.1.18-bin.jar) and i specified in 'database.properties.svn-base' that i'm using MySQL. 我将jdbc连接器附加到我的项目(mysql-connector-java-5.1.18-bin.jar),并且在使用MySQL的“ database.properties.svn-base”中指定了该连接器。 And the service is running. 服务正在运行。 And I placed this 'jar' int webapp/web-inf/lib/ directory. 然后将这个“ jar” int放置在webapp / web-inf / lib /目录中。

But i've noticed, that system can't add this class into Maven dependencies. 但是我注意到,该系统无法将此类添加到Maven依赖项中。

How could i resolve this problem? 我该如何解决这个问题?

Add this to your pom, and remove the jar that you have added by hand 将此添加到您的pom,然后删除您手动添加的jar

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>

Maven controlles the libs in your target web application lib folder, not the other way arround. Maven控制目标Web应用程序的lib文件夹中的库,而不是相反。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM