You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/12/03 12:29:47 UTC
[Bug 54235] New: tomcat jdbc pool stackoverflow error used with
spring
https://issues.apache.org/bugzilla/show_bug.cgi?id=54235
Bug ID: 54235
Summary: tomcat jdbc pool stackoverflow error used with spring
Product: Tomcat Modules
Version: unspecified
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: jdbc-pool
Assignee: dev@tomcat.apache.org
Reporter: yanky.young@gmail.com
Classification: Unclassified
I'm evaluating jdbc pool after reading some blogs on tomcatexpert.com. But
when I try to switch to jdbc pool from dbcp, I'm getting stackoverflow error
like this:
Caused by: java.lang.StackOverflowError
at
java.util.concurrent.AbstractExecutorService.<init>(AbstractExecutorService.java:71)
at
java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1270)
at
java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1163)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:117)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:86)
at
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDataSource(PooledConnection.java:224)
at
org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:180)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:631)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:485)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:86)
at
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDataSource(PooledConnection.java:224)
at
org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:180)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:699)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:631)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:485)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:86)
at
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDataSource(PooledConnection.java:224)
and I noticed that someone had the same issue before but not answered:
http://mail-archives.apache.org/mod_mbox/tomcat-users/201107.mbox/%3C32046311.post@talk.nabble.com%3E
my web app is a typical springmvc+hibernate application, and here is my
applicationcontext datasource part:
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
destroy-method="close">
<property name="driverClassName" value="${telregistry.jdbc.driverClassName}" />
<property name="url" value="${telregistry.jdbc.url}"/>
<property name="username" value="${telregistry.jdbc.username}"/>
<property name="password" value="${telregistry.jdbc.password}"/>
<property name="initialSize" value="5"/>
<property name="initSQL" value="SELECT 1"/>
<property name="minIdle" value="5"/>
<property name="maxIdle" value="50"/>
<property name="maxActive" value="100"/>
<property name="maxWait" value="6000"/>
<property name="validationInterval" value="1800000"/>
<property name="validationQuery" value="SELECT 1"/>
</bean>
my system:
win7 32bit
jdk1.7.0_9(also test on jdk1.6.0_25)
mysql 5.5(also test oracle11g)
spring 3.1.0
jdbc pool(tomcat-jdbc-7.0.30.jar from official maven repo)
And by tomcat container resource configuration, I find a workaround to make
jdbc pool work with spring:
1. add a Resource section in tomcat server.xml to make a global naming resource
2. add a resource-ref section in WEB-INF/web.xml to reference container
resource
3. add a bean section to spring applicationContext.xml to reference container
resouce by spring provided JndiObjectFacetoryBean
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 54235] tomcat jdbc pool stackoverflow error used with spring
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54235
--- Comment #2 from Arjen van der Meijden <ac...@tweakers.net> ---
Do you have autowire in Spring enabled? If so, it'll inject a
'dataSource'-object in the setDataSource-property of your
DataSource-instance...
Its a bit weird that the object has a setDataSource-method at all, but you can
fairly easily fix it by setting autowire="no" on the particular pool, like so:
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
destroy-method="close" autowire="no">
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 54235] tomcat jdbc pool stackoverflow error used with spring
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54235
Filip Hanik <fh...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Filip Hanik <fh...@apache.org> ---
This can only happen if you inject your datasource (the actual pool).
So this must be a misconfiguration on the users part.
Pool now prevents it through r1616595
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 54235] tomcat jdbc pool stackoverflow error used with spring
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54235
Konstantin Kolinko <kn...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
1. The call to ConnectionPool.borrowConnection( ) is caused by setting
<property name="initialSize" value="5"/>
which causes ConnectionPool.init() to create 5 connections.
2. The call to PooledConnection.connectUsingDataSource() is seriously wrong.
It should have called PooledConnection.connectUsingDriver() instead.
This can happen only if poolProperties.getDataSource() is not null.
I do not see how this could have happened. Did Spring injected a recursive
reference by calling DataSource.setDataSource()?
3. When you define the pool via <Resource>, it is created using
org.apache.tomcat.jdbc.pool.DataSourceFactory. The factory calls
dataSource.createPool().
So it might be better to add init-method="createPool".
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org