0

When we are using jdbc pool in tomcat, we are getting transaction lock which never use to happen earlier. We are using tomcat7

<Resource name="jdbc/bm" 
type="javax.sql.DataSource"  
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
initialSize="34"
maxActive="500"   
maxIdle="5"  
username="root" 
testWhileIdle="true"  
removeAbandonedTimeout="60"  
maxWait="-1" 
removeAbandoned="true" 
logAbandoned="true"
validationQuery="select 1" 
validationInterval="60000"
driverClassName="com.mysql.jdbc.Driver" 
password="timrotyo" 
minEvictableIdleTimeMillis="30000" 
timeBetweenEvictionRunsMillis="120000"
testOnBorrow="true"             
url="jdbc:mysql://10.102.57.33:3306/brandmanagement?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8"/>

Exception:

    2017-Aug-01 11:01:29,587 ERROR IRAppAccessInterceptor:54 - 
    org.springframework.dao.CannotAcquireLockException: Hibernate operation: Could not execute JDBC batch update; SQL [update table xxxxx]; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:259)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:426)
        at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
        at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:416)
Rahul
  • 10,830
  • 4
  • 53
  • 88
  • Possible duplicate of [How to debug Lock wait timeout exceeded on MySQL?](https://stackoverflow.com/questions/6000336/how-to-debug-lock-wait-timeout-exceeded-on-mysql) – Kohei TAMURA Aug 03 '17 at 03:16
  • Formatted code. – Rahul Aug 03 '17 at 10:30
  • I don't think its relevant, because it never happened earlier, it start after we moved to jdbc connection pool. – Manoj Reddy Aug 03 '17 at 12:32
  • We have just removed factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" this from server.xml and all the issues are solved, any idea why connection pool is behaving this way ? – Manoj Reddy Aug 10 '17 at 06:22

0 Answers0