Reputation: 12348
Environment:
We get the following stack trace when we try to start tomcat. It used to work, but now it always gives this, and fails to start:
org.apache.tomcat.jdbc.pool.ConnectionPool abandon
WARNING: Connection has been abandoned PooledConnection[com.mysql.jdbc.JDBC4Connection@4db0ee25]:java.lang.Exception
at org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1063)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:780)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:619)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:403)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376)
The context.xml has this:
<Resource name="myapp" auth="Container" type="javax.sql.DataSource"
maxActive="100" minIdle="10" maxIdle="20" maxWait="10000"
username="myapp" password="pass" driverClassName="com.mysql.jdbc.Driver"
validationquery="SELECT 1;"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
initialSize="10"
removeAbandonedTimeout="120"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="60000"
jmxEnabled="true"
url="jdbc:mysql://10.0.2.20:3306/myapp"/>
and the grails datasource has this:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
production {
dataSource {
pooled = false
jndiName = "java:comp/env/myapp"
}
}
What have tried:
Interestingly, I have another server which works perfectly, with identical versions and configurations - the only difference is one is a virtual server hosted with dediserve, the other is a physical server with an lxc container with the tomcat running in it. The dediserve one works.
A big clue could be that it is running liquibase (via the standard grails database migration plugin 1.4.0) automatically on tomcat startup, and it has correctly created the schema, but not any of the data.
Upvotes: 2
Views: 4202
Reputation: 12348
OK, found the solution. Basically, liquibase is taking a VERY long time to start, more than the already very high removeAbandonedTimeout of 120s I had set. I changed this to 1000s and it starts.
Upvotes: 1