@wenshao 你好,想跟你请教个问题:
druid 数据源与纯jdbc相结合,遇到的问题
1、底层是用纯jdbc写的访问oracle数据库
2、将druid数据源与之进行结合时,多次点击页面访问数据库时会出现错误
3、错误信息是:
2014-2-10 10:38:04 com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl info
信息: {dataSource-275} inited
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:146)
at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:211)
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:140)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1355)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1409)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:602)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:876)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
at org.gzaic.report.db.DbPoolConnection.getConnection(DbPoolConnection.java:52)
at org.gzaic.report.db.DBAReport.getConnection(DBAReport.java:73)
at org.gzaic.report.db.DBAReport.SQLQuery(DBAReport.java:197)
at org.gzaic.report.dao.impl.CommonDao.queryListByTable(CommonDao.java:50)
at org.gzaic.report.dao.hr.impl.GwygwflDao.queryList(GwygwflDao.java:28)
at org.gzaic.report.service.hr.impl.GwygwflService.queryList(GwygwflService.java:32)
at org.gzaic.report.servlet.hr.ReportGwygwflServlet.list(ReportGwygwflServlet.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gzaic.report.comm.BaseSerlvet.doPost(BaseSerlvet.java:82)
at org.gzaic.report.comm.BaseSerlvet.doGet(BaseSerlvet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.gzaic.report.comm.EncondingFilter.doFilter(EncondingFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 47 more
4、但是在不使用druid数据源的情况下是ok的,不管怎么访问数据库都不会报错.您能不能帮我看下这是怎么回事。是因为配置的问题还是数据库方面的问题哈。谢谢
5、jdbc配置:
username=aaaaa
password=aaaaa
url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(LOAD_BALANCE=yes)(FAILOVER=on))(CONNECT_DATA=(SERVICE_NAME=aaaa)))
driverClassName=oracle.jdbc.driver.OracleDriver
filters=stat
maxActive=20
initialSize=1
maxWait=60000
minIdle=10
#maxIdle:15
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=300000
validationQuery=select 1 from dual
testWhileIdle=true
testOnBorrow=false
testOnReturn=false
#poolPreparedStatements:true
maxOpenPreparedStatements=20
#对于长时间不使用的连接强制关闭
removeAbandoned=true
#超过30分钟开始关闭空闲连接
removeAbandonedTimeout=1800
#将当前关闭动作记录到日志
logAbandoned=true