C3P0 hangs - Java 1,6

2019-08-11 08:21发布

In continuation with this Websphere hangs due to c3p0 question

Our JSP application itself is a legacy code (written some 5 years back) and we need to maintain it for next 3 years. With the updates to Oracle & WAS the existing code is becoming unstable. Rewriting is not an option due to cost factors

One such problem came when we had to move to Oracle 11. After some research I found out that connection pooling would help. Proper fix is to make changes to the code but cost comes into picture.

After using connection pooing for some time now we found out that the JSP application in WebSphere is hanging more often than normal after introducing C3P0. However introducing c3P0 solved one problem Max cursors reached error in JSP + Hibernate

The Prerequisites on http://www.mchange.com/projects/c3p0/ says C3P0 works well with Java 1.4 and Java 1.5

We are using Java 1.6.x

Has any one had any success in getting c3P0 working with Java 1.6?

Are there any tips/fine tuning that I can do to make c3P0 works with Java 1.6?

My C3P0 settings

 <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
   <property name="hibernate.c3p0.min_size">2</property>
   <property name="hibernate.c3p0.max_size">40</property>
   <property name="hibernate.c3p0.timeout">350</property>
   <property name="hibernate.c3p0.idle_test_period">300</property>
   <property name="hibernate.c3p0.max_statements">0</property>
   <property name="hibernate.c3p0.acquire_increment">1</property>
   <property name="hibernate.c3p0.unreturnedConnectionTimeout">60</property>
   <property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property>

1条回答
聊天终结者
2楼-- · 2019-08-11 09:01

c3p0 works fine in general with java 1.6+.

you might want to upgrade to c3p0 0.9.2.1 or the latest 0.9.5 prerelease if you haven't already (although earlier releases do work in 1.6+).

you'll need to figure out why your app is hanging. in general, during a hang you should dump your Threads and inspect stack traces to see what's going on. if Threads are hanging waiting for Connections from c3p0 (i.e. in the awaitAvailable() method), you probably have a Connection leak and will want to debug it as in the previous hang thread you reference.

查看更多
登录 后发表回答