tomcat 7 factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
在tomcat的lib下,tomcat-dbcp.jar。
tomcat 8 factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
tomcat8把这个驱动类更换了
所以tomcat8的jndi配置,全局配置 /conf/context.xml配置如下:
<Resource
name="jndi/ppms"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
auth="Container"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@xxx:xx:xxx"
username="xxx"
password="xxx"
maxTotal="30"
maxIdle="100"
maxWaitMillis="6000"
initialSize="20"
minIdle="20"
validationQuery="SELECT 1 FROM DUAL"
testWhileIdle="true"
testOnBorrow="false"
timeBetweenEvictionRunsMillis="60000"
minEvictableIdleTimeMillis="1800000"
numTestsPerEvictionRun="10"
removeAbandonedOnBorrow="true"
removeAbandonedTimeout="180"
/>
conf/web.xml配置如下:
<resource-ref>
<description>Oracle Connection</description>
<res-ref-name>jdbc/ppms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>