File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark " Blocking threads - Tomcat Datasource " Watch " Blocking threads - Tomcat Datasource " New topic
Author

Blocking threads - Tomcat Datasource

Santosh Inamdar
Greenhorn

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"
url="jdbcracle:thin:@bcpp-db.tata.net:6490:BCPPP01"
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"/>
</Context>

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(GenericObjectPool.java:781)
- waiting to lock <0x00002aaab439e4a8> (a org.apache.tomcat.dbcp.pool.impl.GenericObjectPool)
at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at com.jpmc.cp.bcpp.db.DBManager.getConnection(DBManager.java:82)
at com.jpmc.cp.bcpp.dao.impl.profile.user.UserProfileDAOImpl.getUserProfileByUserId(UserProfileDAOImpl.java:167)
at com.jpmc.cp.bcpp.services.impl.UserProfileServiceImpl.getUserProfileByUserId(UserProfileServiceImpl.java:29)
at com.jpmc.cp.bcpp.web.interceptors.LoginInterceptor.retrieveUserProfile(LoginInterceptor.java:116)
at com.jpmc.cp.bcpp.web.interceptors.LoginInterceptor.intercept(LoginInterceptor.java:80)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)

Very similar issue is reported in the below URLs
http://forums.sdn.sap.com/thread.jspa?threadID=1824887

http://mail-archives.apache.org/mod_mbox/tomcat-users/200801.mbox/%3C8a81b4af0801272252p69f6e294n776348d34b748637@mail.gmail.com%3E

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Blocking threads - Tomcat Datasource
 
Similar Threads
Application hosted on Tomcat has datasource DBCP issues
Tomcat hanging - two instance configuration
ExceptionInInitializerError in Axis 1.1 with Tomcat 5.0.27
DBCP issue - Timeout waiting for idle object
java.sql.SQLException: No suitable driver