Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

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

 
Abhinandan Patil
Greenhorn
Posts: 8
Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

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(PoolingDataSource.java:103)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at com.ecs.framework.web.jasper.component.panel.ReportPanel.doGenerateReport(ReportPanel.java:402)
at com.ecs.framework.web.jasper.component.panel.BaseReportParamPanel.onGenerateReport(BaseReportParamPanel.java:338)
at com.ecs.framework.web.jasper.component.panel.BaseReportParamPanel$2.onSubmit(BaseReportParamPanel.java:154)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1534)
at org.apache.wicket.markup.html.form.Form.process(Form.java:934)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:767)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:756)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
... 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);
Parameters:
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) {
logger.error(e);
throw e;
}
finally {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
} 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
Marshal
Posts: 3636
184
Clojure IntelliJ IDE Java
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!