關於Pre-bound JDBC Connection found! HibernateTransactionManager does not 異常小結


昨天幫女朋友配置ssh框架的多數據源, 本以為對此已經很熟悉,配置完其他的錯倒是還能接受,調了一下就好了。  唯獨 Pre-bound JDBC Connection found! HibernateTransactionManager does not  這個異常着實浪費了我些時間。

也百度看到網上說是, 因為在代碼中同時使用了jdbc和spring管理的hibernate 兩種事務導致的,所以一開始重心放到了代碼中,可是檢查了N次代碼沒有問題啊, 最后實在不行找一個配置好的開始比對,試了幾次才發現原來是配置事務的xml文件的頭部不對,替換下面這個就好了。    原因:之前的配置少了schema/tx.xsd 和schma/tx/spring-tx.xsd和 schema/aop/spring-aop.xsd  來聲明使用的事務。  這里記錄一下希望可以幫到有同樣異常的小伙伴。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop" xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM