Two Laptop Bag
The moose likes Tomcat and the fly likes  Blocking threads - Tomcat Datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark " Blocking threads - Tomcat Datasource " Watch " Blocking threads - Tomcat Datasource " New topic

Blocking threads - Tomcat Datasource

Santosh Inamdar

Joined: Apr 25, 2011
Posts: 1

Hello All,

We have problem in the PRD web application which is not seen in UAT. This has come to light post to our recent Production release.
Web Application is deployed on Tomcat 6.0.20 version and we use the below JNDI Datasource configuration.
Parameters marked in blue & bold are released with the latest production deployment.

<?xml version="1.0" encoding="UTF-8"?>
<Context debug="0" path="/morcomwcmbcpp">
<Resource auth="Container" type="javax.sql.DataSource" name="jdbc/dsbcppwcm"
username="XYZ" password="MNOP" driverClassName="oracle.jdbc.driver.OracleDriver"
maxActive="100" maxIdle="30" minIdle="5" maxWait="60000"
validationQuery="SELECT 1 FROM DUAL" testWhileIdle="true" testOnBorrow="true" removeAbandoned="false"
validationQueryTimeout="60" removeAbandonedTimeout="300"/>

We have made sure that all the JDBC connections are released in finally block of the code. Also , our UAT and PRD environments are alike.

Below Tomcat Thread dump shows ….

"TP-Processor10" daemon prio=10 tid=0x00002aaaf473f800 nid=0x329d waiting for monitor entry [0x000000004369f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(
- waiting to lock <0x00002aaab439e4a8> (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(
at com.jpmc.cp.bcpp.db.DBManager.getConnection(
at com.jpmc.cp.bcpp.dao.impl.profile.user.UserProfileDAOImpl.getUserProfileByUserId(
at com.jpmc.cp.bcpp.web.interceptors.LoginInterceptor.retrieveUserProfile(
at com.jpmc.cp.bcpp.web.interceptors.LoginInterceptor.intercept(
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
at org.apache.struts2.impl.StrutsActionProxy.execute(
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(
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.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.jk.server.JkCoyoteHandler.invoke(
at org.apache.jk.common.HandlerRequest.invoke(
at org.apache.jk.common.ChannelSocket.invoke(
at org.apache.jk.common.ChannelSocket.processConnection(
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(
at org.apache.tomcat.util.threads.ThreadPool$

Very similar issue is reported in the below URLs

I agree. Here's the link:
subject: Blocking threads - Tomcat Datasource
jQuery in Action, 3rd edition