我正在尝试设置Vibur DBCP以对抗Oracle 11g数据库实例,但我不断收到Oracle异常。
这是URL = jdbc:oracle:thin:@ // db.vonagenetworks.net/MY_SERVICE
当我将它与Tomcat连接池一起使用时,此URL有效。
我收到以下错误......
org.vibur.dbcp.ViburDBCPException: 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 org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:114) ~[vibur-dbcp-1.1.1.jar:?]
at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:53) ~[vibur-dbcp-1.1.1.jar:?]
at org.vibur.objectpool.ConcurrentLinkedPool.create(ConcurrentLinkedPool.java:119) ~[vibur-object-pool-2.0.0.jar:?]
at org.vibur.objectpool.ConcurrentLinkedPool.<init>(ConcurrentLinkedPool.java:110) ~[vibur-object-pool-2.0.0.jar:?]
at org.vibur.dbcp.pool.PoolOperations.<init>(PoolOperations.java:73) ~[vibur-dbcp-1.1.1.jar:?]
at org.vibur.dbcp.ViburDBCPDataSource.start(ViburDBCPDataSource.java:196) ~[vibur-dbcp-1.1.1.jar:?]
at contactmanager.dao.DataSourceInitializer.initializeDataSources(DataSourceInitializer.java:96) [DataSourceInitializer.class:?]
at contactmanager.dao.DataSourceInitializer.init(DataSourceInitializer.java:49) [DataSourceInitializer.class:?]
at javax.servlet.GenericServlet.init(GenericServlet.java:160) [servlet-api.jar:3.0.FR]
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460) [catalina.jar:7.0.47]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.47]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.47]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) [catalina.jar:7.0.47]
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983) [catalina.jar:7.0.47]
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660) [catalina.jar:7.0.47]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_17]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [?:1.7.0_17]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [?:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [?:1.7.0_17]
Caused by: 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) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) ~[ojdbc6.jar:11.2.0.3.0]
at java.sql.DriverManager.getConnection(DriverManager.java:579) ~[?:1.7.0_17]
at java.sql.DriverManager.getConnection(DriverManager.java:221) ~[?:1.7.0_17]
at org.vibur.dbcp.pool.ConnectionFactory.doCreate(ConnectionFactory.java:139) ~[vibur-dbcp-1.1.1.jar:?]
at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:110) ~[vibur-dbcp-1.1.1.jar:?]
... 25 more
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) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6.jar:11.2.0.3.0]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) ~[ojdbc6.jar:11.2.0.3.0]
at java.sql.DriverManager.getConnection(DriverManager.java:579) ~[?:1.7.0_17]
at java.sql.DriverManager.getConnection(DriverManager.java:221) ~[?:1.7.0_17]
at org.vibur.dbcp.pool.ConnectionFactory.doCreate(ConnectionFactory.java:139) ~[vibur-dbcp-1.1.1.jar:?]
at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:110) ~[vibur-dbcp-1.1.1.jar:?]
... 25 more
答案 0 :(得分:3)
当Oracle数据库服务器的可用进程用完时,这似乎是一个常见问题,因此不能再与服务器建立新的连接。有关详细信息,请查看this和this链接。
第二个链接表明可以通过以下方式增加Oracle数据库中的进程数: alter system set processes = 100 scope = spfile;
我认为最好将Oracle中的进程数设置为略高于为vibur-dbcp配置的最大连接数,即如果已配置poolMaxSize = 100,然后将Oracle中的进程数设置为150.如果多个应用程序连接到同一个Oracle数据库服务器,则可能需要将poolMaxSize乘以连接应用程序的数量,然后再添加一些备用额外的50或100它
请告诉我这是否有帮助。