commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Rogers <nrog...@library.wisc.edu>
Subject [DBCP] PoolingConnection
Date Fri, 08 Aug 2003 14:13:17 GMT
I am trying to use the PoolingConnection class to build a pool of 
PreparedStatements.  My code will compile fine, but inevitably upon 
trying to utilize the pool, I get a null pointer exception.  I could not 
find any examples of how to initialize the pool properly.  Can someone 
show me where my code might be going wrong, or at the least, a better 
approach to pooling PreparedStatements?

Code
(the statementPool object is declared at the top of the class)
====
// Create the pool that will hold the PreparedStatements
StackKeyedObjectPoolFactory factory = new StackKeyedObjectPoolFactory();
KeyedObjectPool keyedObjectPool = factory.createPool();
statementPool = new PoolingConnection(conn, keyedObjectPool);

Exception
=====
java.util.NoSuchElementException
	at 
org.apache.commons.pool.impl.StackKeyedObjectPool.borrowObject(Unknown 
Source)
	at 
org.apache.commons.dbcp.PoolingConnection.prepareStatement(PoolingConnection.java:128)
	at 
edu.wisc.library.ltg.exceptionManager.model.OracleImpl.isValidUser(OracleImpl.java:88)
	at 
edu.wisc.library.ltg.exceptionManager.model.ExceptionsModel.isValidUser(ExceptionsModel.java:85)
	at 
edu.wisc.library.ltg.exceptionManager.view.LoginAction.execute(LoginAction.java:45)
	at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
	at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpRequestHandler.java:217)
	at 
org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:194)
	at java.lang.Thread.run(Thread.java:484)




Mime
View raw message