最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Spring?myBatis數(shù)據(jù)庫連接異常問題及解決

 更新時間:2022年06月06日 09:39:08   作者:vera_vera_vera  
這篇文章主要介紹了Spring?myBatis數(shù)據(jù)庫連接異常問題及解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

spring myBatis數(shù)據(jù)庫連接異常

報錯如下

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
### The error may exist in file [E:\Code_zxt\MVNWebDemo\target\classes\mapper\SeckillDao.xml]
### The error may involve org.seckill.dao.SeckillDao.queryById
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.


at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:76)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
at com.sun.proxy.$Proxy13.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:165)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
at com.sun.proxy.$Proxy14.queryById(Unknown Source)
at org.seckill.dao.SeckillDaoTest.TestQueryById(SeckillDaoTest.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 

首先去看mysql服務(wù)是否啟動,發(fā)現(xiàn)啟動正常。

再去看jdbc.properties文件里面url username等寫對沒有,寫的是正確的,但是發(fā)現(xiàn)password是unused。去看spring-dao.xml(spring和mybatis相關(guān)的配置文件),發(fā)現(xiàn)漏寫了password的“}”

如下:

myBatis連接數(shù)據(jù)庫時報錯原因歸納

報錯信息

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:oracl


### The error may exist in sqlMapper/UsersMapper.xml
### The error may involve test.findUserById
### The error occurred while executing a query
### Cause: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:oracl

這里報錯的可能性在于配置文件中的jdbc.url=jdbc:oracle:thin:@localhost:1521:oracl的oracl不是Oracle數(shù)據(jù)庫的SID,數(shù)據(jù)庫的SID是orcl,所以會報這個錯,可以通過服務(wù)查看Oracle的SID進行核對 

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • java8如何根據(jù)list對象中的屬性過濾篩選

    java8如何根據(jù)list對象中的屬性過濾篩選

    這篇文章主要介紹了java8如何根據(jù)list對象中的屬性過濾篩選,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-05-05
  • java中超過long范圍的超大整數(shù)相加算法詳解(面試高頻)

    java中超過long范圍的超大整數(shù)相加算法詳解(面試高頻)

    這篇文章主要介紹了java中超過long范圍的超大整數(shù)相加算法(面試高頻),本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-08-08
  • Java中獲取子字符串的幾種方法示例

    Java中獲取子字符串的幾種方法示例

    這篇文章主要主要給大家總結(jié)了Java中獲取子字符串的幾種方法,分別是采用split的方式、采用indexOf的方式、正則和采用replaceFirst的方式這四種方法,需要的朋友可以參考借鑒,下面來看看詳細的介紹吧
    2017-01-01
  • springboot prototype設(shè)置多例不起作用的解決操作

    springboot prototype設(shè)置多例不起作用的解決操作

    這篇文章主要介紹了springboot prototype設(shè)置多例不起作用的解決操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • springboot多文件或者文件夾壓縮成zip的方法

    springboot多文件或者文件夾壓縮成zip的方法

    最近碰到個需要下載zip壓縮包的需求,于是我在網(wǎng)上找了下別人寫好的zip工具類,下面通過本文給大家分享springboot多文件或者文件夾壓縮成zip的方法,感興趣的朋友一起看看吧
    2024-07-07
  • SpringBoot中的Controller用法示例詳解

    SpringBoot中的Controller用法示例詳解

    Controller是SpringBoot里最基本的組件,他的作用是把用戶提交來的請求通過對URL的匹配,分配給不同的接收器,再進行處理,然后向用戶返回結(jié)果,這篇文章主要介紹了SpringBoot中的Controller用法,需要的朋友可以參考下
    2023-06-06
  • java使用socket實現(xiàn)一個多線程web服務(wù)器的方法

    java使用socket實現(xiàn)一個多線程web服務(wù)器的方法

    今天小編就為大家分享一篇java使用socket實現(xiàn)一個多線程web服務(wù)器的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-10-10
  • Java創(chuàng)建多線程異步執(zhí)行實現(xiàn)代碼解析

    Java創(chuàng)建多線程異步執(zhí)行實現(xiàn)代碼解析

    這篇文章主要介紹了Java創(chuàng)建多線程異步執(zhí)行實現(xiàn)代碼解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-07-07
  • 詳解Spring Boot微服務(wù)如何集成fescar解決分布式事務(wù)問題

    詳解Spring Boot微服務(wù)如何集成fescar解決分布式事務(wù)問題

    這篇文章主要介紹了詳解Spring Boot微服務(wù)如何集成fescar解決分布式事務(wù)問題,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-01-01
  • java固定大小隊列的幾種實現(xiàn)方式詳解

    java固定大小隊列的幾種實現(xiàn)方式詳解

    隊列的特點是節(jié)點的排隊次序和出隊次序按入隊時間先后確定,即先入隊者先出隊,后入隊者后出隊,這篇文章主要給大家介紹了關(guān)于java固定大小隊列的幾種實現(xiàn)方式,需要的朋友可以參考下
    2021-07-07

最新評論

馆陶县| 通城县| 香河县| 阳曲县| 高要市| 上虞市| 三亚市| 尉氏县| 涞水县| 麦盖提县| 十堰市| 长垣县| 漳州市| 河南省| 海兴县| 汾阳市| 科技| 榆中县| 定襄县| 老河口市| 和田市| 大安市| 闽侯县| 深泽县| 勃利县| 莱阳市| 醴陵市| 天长市| 溧阳市| 石河子市| 星子县| 龙游县| 右玉县| 嘉兴市| SHOW| 荥经县| 从江县| 墨玉县| 德州市| 鄱阳县| 老河口市|