运行的时候发现如下错误: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context。原来是Tomcat 5.5.x 的jdbc连接池配置和前面的都有改变,取消了ResourceParameters参数。下面是个例子
调试前的:
<Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="0" displayName="OBS Client Replacement" docBase="D:\OBS_WORK\eclipse\workspace\obs\src\webapp" mapperClass="org.apache.catalina.core.StandardContextMapper" path="/OBS" privileged="false" reloadable="true" swallowOutput="false" useNaming="false" workDir="work\Standalone\localhost\OBS" wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource name="jdbc/obs" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/obs">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>HO2_CTF</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@TG2SERVER:1521:NAGIRADB</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>HO2_CTF</value>
</parameter>
</ResourceParams>
<ResourceLink global="jdbc/obs" name="jdbc/obs" type="javax.sql.DataSource"/>
</Context>
调试后的:
<Context displayName="OBS Client Replacement" docBase="C:/ade/client_package_win/eclipse/workspace/obs/src/webapp" path="/obs" reloadable="true" workDir="work\Catalina\localhost\obs">
<Resource name="jdbc/obs" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/obs">
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@TG2SERVER:1521:NAGIRADB</value>
</parameter>
<parameter>
<name>password</name>
<value>HO2_CTF</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>HO2_CTF</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
<ResourceLink global="jdbc/obs" name="jdbc/obs" type="javax.sql.DataSource"/>
</Context>