异常记录---Error creating bean with name 'sqlSessionFactory'
記錄幾種異常的處理方法:
1、
Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-dao.xml]: Error
setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested
exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
?
原因是缺少spring-jdbc? jar包
引入依賴或jar包即可
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
?
?
2、異常報錯:An SQLException was provoked by the following failure: java.lang.InterruptedException
原因是沒引入mysql-connector-java的jar包,或是mysql-connector-java的版本問題,升級至與mysql版本一致即可。
<dependency><groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
3、springMVC開發web的時候,報錯:java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
原因:未引入jstl包
pom.xml引入jstl,問題解決。
<!-- java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config --><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency>4、在JDBC使用的時候有時候會出現java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents........的錯誤,具體錯誤如下:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
?出現這個的原因是因為?mysql返回的時間總是有問題,比實際時間要早8小時。
解決辦法:
在url后面添加?serverTimezone=Asia/Shanghai :
jdbc.url=jdbc:mysql://127.0.0.1:3306/caipiao?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
?
轉載于:https://www.cnblogs.com/jsoso/p/11216388.html
總結
以上是生活随笔為你收集整理的异常记录---Error creating bean with name 'sqlSessionFactory'的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 学习WebDav
- 下一篇: win7更改文件夹背景图片和文件夹背景色