« | October 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | |
| 公告 |
暂无公告... |
Blog信息 |
blog名称: 日志总数:83 评论数量:123 留言数量:0 访问次数:266270 建立时间:2006年8月17日 |

| |
[中间件]Tomcat升级到5.5,数据源无法使用的问题整理 文章收藏, 软件技术
lylhelin 发表于 2008/3/13 16:04:34 |
近日已经有多人询问此问题,这里简单的说明一下,希望遇到此问题的朋友有帮助
5.0中的配置如下
500)this.width=500'><Resource name="jdbc/student" auth="Container" type="javax.sql.DataSource" />
500)this.width=500'><ResourceParams name="jdbc/student">
500)this.width=500'> <parameter>
500)this.width=500'> <name>factory</name>
500)this.width=500'> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>username</name>
500)this.width=500'> <value>root</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>password</name>
500)this.width=500'> <value>sa</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>driverClassName</name>
500)this.width=500'> <value>com.mysql.jdbc.Driver</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>url</name>
500)this.width=500'> <value>jdbc:mysql:// localhost:3306/student?useUnicode=true&characterEncoding=UTF-8</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>maxActive</name>
500)this.width=500'> <value>20</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>maxIdle</name>
500)this.width=500'> <value>5</value>
500)this.width=500'> </parameter>
500)this.width=500'> <parameter>
500)this.width=500'> <name>maxWait</name>
500)this.width=500'> <value>10000</value>
500)this.width=500'> </parameter>
500)this.width=500'></ResourceParams>
在5.5下面,报的异常如下
500)this.width=500'>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
解决方法:
其实在5.5的文档里面,已经给出了配置的标准写法。将数据源修改为如下格式即可
500)this.width=500'><Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
500)this.width=500'> maxActive="100" maxIdle="30" maxWait="10000"
500)this.width=500'> username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver"
500)this.width=500'> url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
本文来自:www.ailiss.cn |
|
|