SSH解决Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/xxx'

苏昂雄
2023-12-01

当出现以下错误
Struts Problem Report
Struts has detected an unhandled exception:

Messages:
No suitable driver
Cannot create JDBC driver of class ‘’ for connect URL ‘jdbc:mysql://localhost:3306/bbs’
Could not open connection
Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection
File: java/sql/DriverManager.java
Line number: 315
打开spring配置文件,默认为applicationContext.xml。
找到<bean id="dataSource"class=“org.apache.commons.dbcp.BasicDataSource”>找到这个bean,
在bean里面添加<property name="driverClassName"value=“com.mysql.jdbc.Driver” />
即可。
错误原因是没有添加jdbc连接桥

————————————————
版权声明:本文为CSDN博主「JJH2017」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ck784101777/article/details/80606074

 类似资料: