1. 程式人生 > >SSH解決Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/xxx'

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

當出現以下錯誤

Struts Problem Report

Struts has detected an unhandled exception:

Messages:
  1. No suitable driver
  2. Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/bbs'
  3. Could not open connection
  4. 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連線橋