我遇到了这个小问题:
pom
像这样添加了对我的依赖
....
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.6</version>
</dependency>
.. 已将 Maven 依赖项添加到我的war
应用程序build path
我的 context.xml 看起来像:
<?xml version='1.0' encoding='utf-8'?>
<Context reloadable="true">
<Resource name="jdbc/TestDS" auth="Container"
type="javax.sql.DataSource"
driverClass="net.sourceforge.jtds.jdbcx.JtdsDataSource"
url="jdbc:jtds:sqlserver://localhost:1433/testdb"
username="sa" password=""/>
</Context>
...
仍然当我执行mvn tomcat:run
. 我明白了
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ''
for connect URL 'jdbc:jtds:sqlserver://localhost:1433/testdb'
.....
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
... 36 more