/** 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 -> Hibernate Annotations 3.3.0.GA
2007-06-01 10:24:13,937 INFO hibernate.cfg.Environment -> Hibernate 3.2.4.sp1
2007-06-01 10:24:13,968 INFO hibernate.cfg.Environment -> loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
2007-06-01 10:24:13,968 INFO hibernate.cfg.Environment -> Bytecode provider name : cglib
2007-06-01 10:24:13,984 INFO hibernate.cfg.Environment -> using JDK 1.4 java.sql.Timestamp handling
2007-06-01 10:24:14,187 INFO hibernate.cfg.Configuration -> configuring from resource: /hibernate.cfg.xml
2007-06-01 10:24:14,187 INFO hibernate.cfg.Configuration -> Configuration resource: /hibernate.cfg.xml
2007-06-01 10:24:15,015 DEBUG hibernate.util.DTDEntityResolver -> 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 -> recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
2007-06-01 10:24:15,015 DEBUG hibernate.util.DTDEntityResolver -> 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…