Bookmark Topic Watch Topic
  • New Topic

java.util.NoSuchElementException: Timeout waiting for idle object While extracting Reports  RSS feed

Abhinandan Patil
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator

Can Anybody help me out to resolve the below said issue? I stuck in finding solution to this issue in Production environment where count of reports being extracted is high (around 1000 reports in 2 hour 40 mins). Below exception is getting printed in Application logs files

[http-4020-119] 09/15/15 13:38:55.203 : [ org.apache.commons.dbcp.SQLNestedException ] Cannot get a connection, pool exhaustedorg.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
at org.apache.commons.dbcp.PoolingDataSource.getConnection(
at org.apache.commons.dbcp.BasicDataSource.getConnection(
at com.ecs.framework.web.jasper.component.panel.ReportPanel.doGenerateReport(
at com.ecs.framework.web.jasper.component.panel.BaseReportParamPanel.onGenerateReport(
at com.ecs.framework.web.jasper.component.panel.BaseReportParamPanel$2.onSubmit(
at org.apache.wicket.markup.html.form.Form.delegateSubmit(
at org.apache.wicket.markup.html.form.Form.process(
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.wicket.RequestListenerInterface.invoke(
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(
at org.apache.wicket.RequestCycle.processEventsAndRespond(
at org.apache.wicket.RequestCycle.step(
at org.apache.wicket.RequestCycle.steps(
at org.apache.wicket.RequestCycle.request(
at org.apache.wicket.protocol.http.WicketFilter.doGet(
at org.apache.wicket.protocol.http.WicketFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
at org.springframework.web.filter.OncePerRequestFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(
at org.apache.commons.dbcp.PoolingDataSource.getConnection(
... 36 more

I'm using Wicket 2.4.8 as front end from where we are giving calls to Export Jasper reports using JasperFillManager's fillReport().

Actual Method Call : JasperFillManager.fillReport(getJasperReport(), parameters, conn);
1. getJasperReport() is instance of JasperReport report.
2. Parameters are the object of type HashMap<String, Object>.
3. conn is Jdbc poolable connection object retrieved from DataSource.getConnection().

Important details:
1. We are using tomcat 6 as web container, Oracle 12G database, jdk 1.6
2. jdbc client is ojdbc6.jar
4. jasper reports 3.7.2
5. Number of end users of my application are huge in counts. May be range between 1000 to 1500 Concurrent users can login and extract some ATM banking reports with huge amount of data.
6. On production, we have 5 core CPU with 56 GB of RAM for each node and there are two active nodes are there and incoming requests for applications are balanced using DNS routing logic.

Solutions i suggested before:
1. Tomcat optimization parameters : Changes in Connector tag in server.xml. Added below parameters:
-- maxThreads="500",enableLookups="false", acceptCount="100"
2. Initializing JVM with below parameters :
-- JAVA_OPTS="$JAVA_OPTS -XX:PermSize=512m -XX:MaxPermSize=512m –Xms2048m –Xmx2048m"
3. Upgrading oracle client drivers:
-- Earlier it was ojdbc5, I have upgraded to ojdbc6.jar
4. Java connection pooling parameters in initialising data source:
-- <property name="maxActive" value="50"/>
<property name="maxIdle" value="20"/>
<property name="maxWait" value="5000"/>
<property name="minEvictableIdleTimeMillis" value="30000"/>

As I searched on this exception in jasper community, I'm able to see the comments related to connection should be closed by the caller of the jasper reports. But I have cross checked the caller as here in my case Apache Wicket 2.4.8, Below code is being called to exctract jasper reports and it seems that the connection being passed to reports extraction method (Fillreport) is properly closed in finally block.

protected JasperPrint newJasperPrint() throws JRException
final JasperPrint jasperPrint;
if ( getConn() != null ) {
Connection conn = getConn();
try {
jasperPrint = JasperFillManager.fillReport(getJasperReport(), parameters, conn);
catch(JRException e) {
throw e;
finally {
try {
} catch (SQLException e) {
} else {
jasperPrint = JasperFillManager.fillReport(getJasperReport(), parameters, getDataSource());
return jasperPrint;

Can any one suggest is this issue has already faced/resolved by someone? Please help me out as this has been reported since long time and all my solutions have not worked till the time.

I appriciate your help in advance!

Thanks and regards,
Abhinandan Patil
Tim Cooke
Posts: 3873
Clojure IntelliJ IDE Java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!