Engenharia Reversa no Hibernate

Olá pessoal,

Estou seguindo as instruções do livro “Java Persistence with Hibernate” para fazer a geração dos arquivos hbm.xml e também os POJO’s a partir de um schema de banco de dados mas não está funcionando.

O meu arquivo, cujo nome é sag.db.properties, está da seguinte forma:

hibernate.dialect = org.hibernate.dialect.Oracle9Dialect
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.url = url_conexao
hibernate.connection.username = usuario_conexao
hibernate.connection.password = senha_conexao

Os parâmetros estão corretos porque eu fiz uma classe Java para me conectar ao banco usando esses parâmetros e funcionou.

Já no meu arquivo build.xml eu adicionei o seguinte bloco:

<taskdef name=“hibernatetool"
classname=“org.hibernate.tool.ant.HibernateToolTask"
classpathref=“project.classpath”/>
<target name=“reveng.hbmxml” description=“Produces XML mapping files in src directory”>
<hibernatetool destdir=”${basedir}/src”>
<jdbcconfiguration
propertyfile="${basedir}/sag.db.properties"
revengfile="${basedir}/sag.reveng.xml"/>
<hbm2hbmxml/> <!-- Export Hibernate XML files -->
<hbm2cfgxml/> <!-- Export a hibernate.cfg.xml file -->
</hibernatetool>
</target>

&lt;target name="reveng.pojos" description="Produces Java classes from XML mappings"&gt;
	&lt;hibernatetool destdir="${basedir}/src"&gt;
		&lt;configuration&gt;
			&lt;fileset dir="${basedir}/src"&gt;
				&lt;include name="**/*.hbm.xml"/&gt;
			&lt;/fileset&gt;
		&lt;/configuration&gt;
		&lt;hbm2java/&gt; &lt;!-- Generate entity class source --&gt;
	&lt;/hibernatetool&gt;
&lt;/target&gt;

&lt;target name="reveng.entities" description="Produces Java entity classes in src directory"&gt;
	&lt;hibernatetool destdir="${basedir}/src"&gt;
		&lt;jdbcconfiguration
			propertyfile="${basedir}/sag.db.properties"
			revengfile="${basedir}/sag.reveng.xml"/&gt;
		&lt;hbm2java jdk5="true" ejb3="true"/&gt;
		&lt;hbm2cfgxml ejb3="true"/&gt;
	&lt;/hibernatetool&gt;
&lt;/target&gt;

Por fim, meu arquivo sag.reveng.xml está da seguinte forma:

&lt?xml version=“1.0” encoding=“UTF-8”?&gt
<!DOCTYPE hibernate-reverse-engineering SYSTEM
"http://hibernate.sourceforge.net/
? hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<table-filter match-name=".*" package=“sag”/>
</hibernate-reverse-engineering>

Só que quando eu executo o comando ant -verbose sag.revenge.xml eu obtenho a seguinte mensagem de erro (stack trace completo):

[hibernatetool] An exception occurred while running exporter #2:hbm2hbmxml (Gene
rates a set of hbm.xml files)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.MappingException: Could not configure overrides fr
om file: D:\Renato\workdir\sag\sag.reveng.xml
[hibernatetool] org.hibernate.MappingException: org.dom4j.DocumentException: Con
nection timed out: connect Nested exception: Connection timed out: connect
[hibernatetool] org.dom4j.DocumentException: Connection timed out: connect Neste
d exception: Connection timed out: connect

BUILD FAILED
D:\Renato\workdir\sag\build.xml:33: org.hibernate.MappingException: Could not co
nfigure overrides from file: D:\Renato\workdir\sag\sag.reveng.xml
at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToo
lTask.java:211)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:174)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.hibernate.MappingException: Could not configure overrides from fi
le: D:\Renato\workdir\sag\sag.reveng.xml
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:106)
at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConf
igurationTask.java:71)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(Configurati
onTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateTo
olTask.java:287)
at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolT
ask.java:303)
at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.ja
va:94)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:171)
… 17 more
Caused by: org.hibernate.MappingException: org.dom4j.DocumentException: Connecti
on timed out: connect Nested exception: Connection timed out: connect
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:144)
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:102)
… 24 more
Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exc
eption: Connection timed out: connect
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:134)
… 25 more
— Nested Exception —
org.hibernate.MappingException: Could not configure overrides from file: D:\Rena
to\workdir\sag\sag.reveng.xml
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:106)
at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConf
igurationTask.java:71)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(Configurati
onTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateTo
olTask.java:287)
at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolT
ask.java:303)
at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.ja
va:94)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.hibernate.MappingException: org.dom4j.DocumentException: Connecti
on timed out: connect Nested exception: Connection timed out: connect
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:144)
at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepositor
y.java:102)
… 24 more
Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exc
eption: Connection timed out: connect
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at org.hibernate.cfg.reveng.OverrideRepository.addInputStream(OverrideRe
pository.java:134)
… 25 more

Alguém tem alguma dica do porquê desse erro? Será que eu não posso executar a tarefa ant diretamente pelo prompt de comando? Será que isso tem que ser feito através de algum plugin de alguma IDE? Estou perguntando porque já pesquisei em alguns forums e muita gente que fez engenharia reserva o fez através de plugin do Eclipse.

Agradeço desde já.