[問題] 連線池無法取出連線消失

看板java作者時間8年前 (2016/02/13 01:10), 8年前編輯推噓2(2011)
留言13則, 3人參與, 最新討論串1/1
我寫了一段程式如下: https://goo.gl/5aSVTS 但是會跳出以下錯誤: https://goo.gl/qeG48a https://goo.gl/eGQACV google到的說法是context.xml設定的問題 但是我不管修改哪裡都還是一樣 可能是url或帳密寫錯 但是我把context.xml跟資料庫連線的內容作比較 context.xml: https://goo.gl/ZOFOFA oracle sql developer的連線設定: https://goo.gl/AhnBKU url跟帳密都是一樣的 web.xml: https://goo.gl/KnzXKN 那這樣到底應該怎麼修改才好呢 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.136.193.198 ※ 文章網址: https://www.ptt.cc/bbs/java/M.1455297057.A.402.html ※ 編輯: lueichun (220.136.193.198), 02/13/2016 01:14:25

02/13 09:14, , 1F
確定 oracle 的 jdbc driver 有在 classpath 嗎?
02/13 09:14, 1F

02/13 09:18, , 2F
check $CATALINA_HOME/lib
02/13 09:18, 2F

02/13 09:18, , 3F
能否提供產生entityManager的程式碼?
02/13 09:18, 3F

02/13 09:18, , 4F
看看有沒有類似 ojdbcXX.jar 之類
02/13 09:18, 4F
ojdbc6.jar有在c:tomcat\lib裡 https://goo.gl/54aaT2 entityManager: https://goo.gl/VdGCfU ※ 編輯: lueichun (118.160.98.251), 02/13/2016 12:44:29

02/14 01:11, , 5F
改成java:comp/env/jdbc/testConnectionPool試試
02/14 01:11, 5F
修改後: https://goo.gl/gtU6o4 https://goo.gl/47gLHW https://goo.gl/NDvSlM 還是一樣的錯誤 ※ 編輯: lueichun (118.160.98.251), 02/14/2016 01:35:20

02/14 15:55, , 6F
樓上:從error 就看到是data source 建立不了,瞎猜jn
02/14 15:55, 6F

02/14 15:55, , 7F
di name 是浪費時間吧
02/14 15:55, 7F

02/14 15:58, , 8F
另,原po: 在新一點的oracle driver jar中,driver cl
02/14 15:58, 8F

02/14 15:58, , 9F
ass 印象中搬了到 oracle.jdbc.OracleDriver (自己找
02/14 15:58, 9F

02/14 15:58, , 10F
找)
02/14 15:58, 10F
ORACLE driver的位置是oracle.jdbc.driver.OracleDriver https://goo.gl/GVS6o4 ※ 編輯: lueichun (220.136.193.140), 02/14/2016 20:27:27

03/15 00:12, , 11F
終於解決了 解法就是將context.xml的連線池設定再重新打
03/15 00:12, 11F

03/15 00:13, , 12F
一遍就好了 如果那段設定是用複製貼上的就會出錯
03/15 00:13, 12F

03/15 00:14, , 13F
不知道為什麼會這樣
03/15 00:14, 13F
文章代碼(AID): #1MlX8XG2 (java)