O que há de errado aqui ? (Hibernate)

               /** quando executo esse bloco, fica preso nessa linha e nao da erro*/
 factory = new AnnotationConfiguration().configure().buildSessionFactory();
            
// nao chega nem executar o resto do codigo
            Session session = factory.openSession();
            
            Transaction tran = session.beginTransaction();
            
            Pessoa p = new Pessoa();
            
            p.setNome("Teste");
            p.setId(new Integer(10));
            
            session.save(p);
            
            session.flush();
            
            tran.commit();
            
            session.close();

LOG:

2007-06-01 10:24:13,906 INFO  cfg.annotations.Version  -&gt Hibernate Annotations 3.3.0.GA
  2007-06-01 10:24:13,937 INFO  hibernate.cfg.Environment  -&gt Hibernate 3.2.4.sp1
  2007-06-01 10:24:13,968 INFO  hibernate.cfg.Environment  -&gt loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
  2007-06-01 10:24:13,968 INFO  hibernate.cfg.Environment  -&gt Bytecode provider name : cglib
  2007-06-01 10:24:13,984 INFO  hibernate.cfg.Environment  -&gt using JDK 1.4 java.sql.Timestamp handling
  2007-06-01 10:24:14,187 INFO  hibernate.cfg.Configuration  -&gt configuring from resource: /hibernate.cfg.xml
  2007-06-01 10:24:14,187 INFO  hibernate.cfg.Configuration  -&gt Configuration resource: /hibernate.cfg.xml
  2007-06-01 10:24:15,015 DEBUG hibernate.util.DTDEntityResolver  -&gt trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.2.dtd]
  2007-06-01 10:24:15,015 DEBUG hibernate.util.DTDEntityResolver  -&gt recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
  2007-06-01 10:24:15,015 DEBUG hibernate.util.DTDEntityResolver  -&gt unable to locate [http://hibernate.sourceforge.net/hibernate-configuration-3.2.dtd] on classpath

Depois de algum tempo lanca exception de time out


org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1494)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
        at Teste.main(Teste.java:18)
Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)
        ... 3 more

valeu…

Tá faltando o arquivo de configuração… hibernate.cfg.xml

E além disso, tem certeza que todas as bibliotecas do hibernate estão no classpath?

Esse ta no diretorio junto com os codigos fonte.

Adicionei todos os .jar do hibernate (dir: lib e na pasta principal - total 39 ), + .jar do Hibernate annotations ( 3 jar)

Se for uma aplicação web tem que estar na pasta WEB-INF/classes

Se não, acho que tem que estar na mesma basta dos .class. Tem um método (vi num outro post) para especificar o local do arquivo.

Vc usa IDE? adiciona no CLASSPATCH e ve se passa
ve tmb se vc tem o arquivo hibernate.properties ou o hibernate.cfg.xml