Bonjour,

Mon problème est que je ne peux pas me connecter à ma base de données sous MySQL avec hibernate .J'ai le stacktrace suivant :
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 
15 août 2008 12:28:05 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
15 août 2008 12:28:05 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
15 août 2008 12:28:05 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
15 août 2008 12:28:05 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
15 août 2008 12:28:05 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
15 août 2008 12:28:05 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
15 août 2008 12:28:06 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : com/dao/FBEleve/Eleve.hbm.xml
15 août 2008 12:28:06 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.dao.FBEleve.Eleve -> fb_eleves
15 août 2008 12:28:06 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
15 août 2008 12:28:06 org.hibernate.connection.C3P0ConnectionProvider configure
INFO: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://172.16.0.43:3306/test"
15 août 2008 12:28:06 org.hibernate.connection.C3P0ConnectionProvider configure
INFO: Connection properties: {user=sofien, password=****}
15 août 2008 12:28:06 org.hibernate.connection.C3P0ConnectionProvider configure
INFO: autocommit mode: false
15 août 2008 12:28:07 com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
15 août 2008 12:28:07 com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.0 [built 11-July-2005 00:43:29 -0400; debug? true; trace: 10]
15 août 2008 12:28:07 com.mchange.v2.c3p0.PoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@13c1b02 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1507fb2 [ acquireIncrement -> 5, acquireRetryAttempts -> 100, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1507fb2, idleConnectionTestPeriod -> 1000, initialPoolSize -> 5, maxIdleTime -> 300, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@edc3a2 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> edc3a2, jdbcUrl -> jdbc:mysql://172.16.0.43:3306/test", properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 13c1b02, numHelperThreads -> 3 ]
15 août 2008 12:29:47 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
ATTENTION: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ec4a87 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (100).
15 août 2008 12:29:47 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
ATTENTION: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1d64c37 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (100).
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
ATTENTION: Could not obtain connection metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:56)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at persistence.HibernateUtil.<clinit>(HibernateUtil.java:15)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:970)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
... 6 more
15 août 2008 12:29:47 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
15 août 2008 12:29:47 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
15 août 2008 12:29:47 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: enabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15 août 2008 12:29:47 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
15 août 2008 12:29:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
15 août 2008 12:29:48 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
15 août 2008 12:29:48 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
15 août 2008 12:29:53 org.hibernate.impl.SessionFactoryImpl close
INFO: closing
Comme le montre le text en gras, je ne peux pas avoir de connexion à la base de données.

voici mon fichier hibernate.cfg.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
 
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
<hibernate-configuration>
<session-factory>
<!-- JDBC connection to Oracle
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1522:test</property>
<property name="hibernate.connection.username">test</property>
<property name="hibernate.connection.password">test</property>-->
 
<!-- JDBC connection to MySQL -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://172.16.0.43:3306/test"</property>
<property name="hibernate.connection.username">sofien</property>
<property name="hibernate.connection.password">mysql</property>
 
<!-- Common parameters -->
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">1000</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.acquireRetryAttempts">60</property>
 
<!-- SQL to stdout logging -->
<property name="show_sql">false</property>
<property name="format_sql">false</property>
<property name="use_sql_comments">true</property>
<!-- <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>-->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
 
<!-- <mapping resource="hello/Message.hbm.xml"/>-->
<!-- <mapping resource="com/dao/eleve/Eleve.hbm.xml"/>-->
<mapping resource="com/dao/FBEleve/Eleve.hbm.xml"/>
<!-- <mapping resource="com/dao/eleve/Eleve_s.hbm.xml"/>-->
</session-factory>
</hibernate-configuration>
Merci de m'aider !