<?xml version="1.0" encoding="UTF-8"?>
<!– The contents of this file will be loaded for each web application –>
<context>
<!– Default set of monitored resources 172.16.5.28:KM–>
<watchedresource>WEB-INF/web.xml</watchedresource>
<resource?
???????? name="jdbc/test"
???????? auth="Container"
???????? type="javax.sql.DataSource"
???????? maxactive="500"
???????? maxidle="30"
???????? maxwait="10000"
???????? username="test"
???????? password="test
???????? driverClassName="oracle.jdbc.OracleDriver"
???????? url="jdbc:oracle:thin:@localhost:1521:orcl">
</resource>
</context>
然后附件中的文件就派上用場了(encrypt2.bat,commons-dbcp-1.2.2.jar和commons-pool-1.4.jar )
1、進入tomcat的安裝目錄: tomcatroot\common\lib
2、復制encrypt2.bat和commons-dbcp-1.2.2.jar和commons-pool-1.4.jar 進入該目錄
3、進入cmd狀態,切換入tomcatroot\common\lib目錄 ,非常重要的是需要把webapps下面的各個應用里面的重復的jar刪掉也就是要把所有的字母里面的commons-dbcp*.jar和commons-pool*.jar刪掉
4、輸入encrypt2.bat test (test)還是原密碼,界面上會輸出:
test 加密后: jAVagnSq2eQ=
test 解密后: test
5、修改context.xml password="jAVagnSq2eQ=" 并注意增加一行: factory="org.apache.commons.dbcp.BasicDataSourceFactory"
那么我們最后的配置就是:
<?xml version="1.0" encoding="UTF-8"?>
<!– The contents of this file will be loaded for each web application –>
<context>
<!– Default set of monitored resources 172.16.5.28:KM–>
<watchedresource>WEB-INF/web.xml</watchedresource>
<resource
?????????? name="jdbc/test"
?????????? auth="Container"
?????????? type="javax.sql.DataSource"
?????????? maxactive="500" maxidle="30"
?????????? maxwait="10000"
?????????? username="test"
?????????? password="jAVagnSq2eQ="
?????????? driverClassName="oracle.jdbc.OracleDriver"
?????????? factory="org.apache.commons.dbcp.BasicDataSourceFactory"??????????????
?????????? url="jdbc:oracle:thin:@localhost:1521:orcl">
</resource>
</context>
好了,重啟試試吧
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
