Bonjour tt le monde,

j'essaie de faire fonctionner spring + c3p0 ensemble, et j'ai un petit problème.

Des nouvelles connexions sont ouvertes à quasiment chaque requête. Mon pool est rapidement saturé de connexions inutilisées... et mon application freeze en attendant d'acquérir des connexions

Voici un extrait des logs c3p0:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
DEBUG - BasicResourcePool          - acquire test -- pool size: 12; target_pool_size: 12; desired target? 13
DEBUG - BasicResourcePool          - incremented pending_acquires: 1
DEBUG - BasicResourcePool          - incremented pending_acquires: 2
...
 com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2)
DEBUG - BasicResourcePool          - trace com.mchange.v2.resourcepool.BasicResourcePool@4ce427 [managed: 15, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2)
DEBUG - BasicResourcePool          - trace com.mchange.v2.resourcepool.BasicResourcePool@4ce427 [managed: 15, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2)
DEBUG - BasicResourcePool          - trace com.mchange.v2.resourcepool.BasicResourcePool@4ce427 [managed: 15, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2)
 DEBUG - BasicResourcePool          - acquire test -- pool is already maxed out. [managed: 15; max: 15]
DEBUG - BasicResourcePool          - awaitAvailable(): com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2
DEBUG - BasicResourcePool          - trace com.mchange.v2.resourcepool.BasicResourcePool@4ce427 [managed: 15, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1169fb2)
Voici la configuration spring:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
 
    <!-- DAO's -->
    <bean id="ConfigDAO" class="hibernate.ConfigDAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <!-- ... plein de DAO déclarés-->
 
 
 
    <bean id="myDataSource"
        class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="com.mysql.jdbc.Driver" />
        <property name="jdbcUrl"
            value="jdbc:mysql://localhost/xxx" />
        <property name="user" value="xxx" />
        <property name="password" value="xxx" />
 
    </bean>
 
 
 
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">        
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property name="dataSource">
            <ref bean="myDataSource" />
        </property>
 
    </bean>
 
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
 
 
    <!-- SERVICES -->
    <bean id="GeneralServiceTarget" class="services.GeneralService">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <bean id="GeneralService"
        class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value>services.IGeneralService</value>
        </property>
        <property name="interceptorNames">
            <list>
                <value>generalServiceTransactionInterceptor</value>
                <value>GeneralServiceTarget</value>
            </list>
        </property>
    </bean>
    <bean id="generalServiceTransactionInterceptor"
        class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager" />
        </property>
        <property name="transactionAttributeSource">
            <value>
                services.IGeneralService.*=PROPAGATION_REQUIRED
            </value>
        </property>
    </bean>
</beans>
Le fichier hibernate.cfg.xml ne contient que la définition de mes fichiers de mapping *.hbm.xml

Et ici mon web.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
 
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
 
    <display-name>XYZ</display-name>
 
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
 
    <filter>
        <filter-name>openSessionInViewFilterXXX</filter-name>
        <filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
    </filter>
 
 
    <filter-mapping>
        <filter-name>openSessionInViewFilterXXX</filter-name>
        <url-pattern>/xxx/*</url-pattern>
    </filter-mapping>
    
    
    <filter>
        <filter-name>openSessionInViewFilterYYY</filter-name>
        <filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
    </filter>
 
 
    <filter-mapping>
        <filter-name>openSessionInViewFilterYYY</filter-name>
        <url-pattern>/yyy/*</url-pattern>
    </filter-mapping>
 
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
 
 
    <filter>
        <filter-name>XXX</filter-name>
        <filter-class>
            org.apache.wicket.protocol.http.WicketFilter
        </filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>xxx.XXX</param-value>
        </init-param>
    </filter>
 
    <filter-mapping>
        <filter-name>XXX</filter-name>
        <url-pattern>/xxx/*</url-pattern>
    </filter-mapping>
 
 
    <filter>
        <filter-name>YYY</filter-name>
        <filter-class>
            org.apache.wicket.protocol.http.WicketFilter
        </filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>yyy.YYY</param-value>
        </init-param>
    </filter>
 
    <filter-mapping>
        <filter-name>YYY</filter-name>
        <url-pattern>/yyy/*</url-pattern>
    </filter-mapping>
 
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
Est-ce que quelqu'un sait ce qu'il manque?

Merci d'avance!!