Bonjour,

J'ai un petit script ANT pour générer ma base de données:
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
<project name="jpa-hibernate" default="compile" basedir=".">
 
	<!-- nom du projet et version -->
	<property name="proj.name" value="jpa-hibernate" />
	<property name="proj.shortname" value="jpa-hibernate" />
	<property name="version" value="1.0" />
 
	<!-- Propriété globales -->
	<property name="src.java.dir" value="src" />
	<property name="lib.dir" value="I:\WebApp\JPA\lib" />
	<property name="build.dir" value="bin" />
 
	<!-- le Classpath du projet -->
	<path id="project.classpath">
		<fileset dir="${lib.dir}">
			<include name="**/*.jar" />
		</fileset>
	</path>
 
	<!-- les fichiers de configuration qui doivent être dans le classpath-->
	<patternset id="conf">
		<include name="**/*.xml" />
		<include name="**/*.properties" />
	</patternset>
 
	<!-- Nettoyage projet -->
	<target name="clean" description="Nettoyer le projet">
		<delete dir="${build.dir}" />
		<mkdir dir="${build.dir}" />
	</target>
 
	<!-- Compilation projet -->
	<target name="compile" depends="clean">
		<javac srcdir="${src.java.dir}" destdir="${build.dir}" classpathref="project.classpath" />
	</target>
 
	<!-- Copier les fichiers de configuration dans le classpath -->
	<target name="copyconf">
		<mkdir dir="${build.dir}" />
		<copy todir="${build.dir}">
			<fileset dir="${src.java.dir}">
				<patternset refid="conf" />
			</fileset>
		</copy>
	</target>
 
	<!-- Hibernate Tools -->
	<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath" />
 
	<!-- Générer le schéma de la base -->
	<target name="DDL" depends="compile, copyconf" description="Génération DDL base">
 
		<hibernatetool destdir="${basedir}">
			<classpath path="${build.dir}" />
			<!-- Utiliser META-INF/persistence.xml -->
			<jpaconfiguration />
			<!-- export -->
			<hbm2ddl drop="true" create="true" export="false" outputfilename="ddl/schema.sql" delimiter=";" format="true" />
		</hibernatetool>
	</target>
 
	<!-- Générer la base -->
	<target name="BD" depends="compile, copyconf" description="Génération BD">
 
		<hibernatetool destdir="${basedir}">
			<classpath path="${build.dir}" />
			<!-- Utiliser META-INF/persistence.xml -->
			<jpaconfiguration />
			<!-- export -->
			<hbm2ddl drop="true" create="true" export="true" outputfilename="ddl/schema.sql" delimiter=";" format="true" />
		</hibernatetool>
	</target>
</project>
Tout à la fin j'ai la tâche BD qui génère ma base de données.
Le problème est que j'ai l'erreur suivante à l'exécution :
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] 16:37:24,340 ERROR SchemaExport:202 - schema export unsuccessful
[hibernatetool] java.sql.SQLException: Connections could not be acquired from the underlying database!
[hibernatetool] at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
[hibernatetool] at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
[hibernatetool] at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
[hibernatetool] at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
[hibernatetool] at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
[hibernatetool] at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:55)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[hibernatetool] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[hibernatetool] at java.lang.reflect.Method.invoke(Method.java:483)
[hibernatetool] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:435)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:452)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:139)
[hibernatetool] Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
[hibernatetool] at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:970)
[hibernatetool] at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:208)
[hibernatetool] at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
[hibernatetool] ... 23 more
[hibernatetool] 1 errors occurred while performing <hbm2ddl>.
[hibernatetool] Error #1: java.sql.SQLException: Connections could not be acquired from the underlying database!
Qqun a-t-il une idée du problème ?
Merci d'avance pour votre précieuse aide