Pessoal,
Sou iniciante em Hibernate... estava tentando colocar para rodar o exemplo que vem no Hibernate Referente (Quick Start With Tomcat) e encontrei problemas... criei uma classe idêntica à que o tutorial mostra e tentei usá-la a partir de um jsp, como se segue:
Endereco e = new Endereco();
e.setEndereco("Rua Itajubá");
e.setNumero("150");
e.setComplemento("Apto 102");
e.setBairro("Jd Andere");
e.setCidade("Varginha");
e.setUf("MG");
e.setCep(37006400);
e.setTipo('C');
Session s = HibernateUtil.currentSession();
Transaction t = s.beginTransaction();
s.save(e);
t.commit();
HibernateUtil.closeSession();
Quando chamo a página dá o erro:
exception
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.jsp.teste.hbm_jsp._jspService(hbm_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
java.lang.NoClassDefFoundError
org.apache.jsp.jsp.teste.hbm_jsp._jspService(hbm_jsp.java:60)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
10:18:30,957 INFO Environment:432 - Hibernate 2.1.1
10:18:30,973 INFO Environment:461 - hibernate.properties not found
10:18:30,989 INFO Environment:481 - using CGLIB reflection optimizer
10:18:30,989 INFO Configuration:843 - configuring from resource: /hibernate.cfg.xml
10:18:30,989 INFO Configuration:815 - Configuration resource: /hibernate.cfg.xml
10:18:31,926 INFO Configuration:300 - Mapping resource: Endereco.hbm.xml
10:18:32,114 INFO Binder:225 - Mapping class: gs.cav.modelos.Endereco -> endereco
10:18:32,270 INFO Configuration:998 - Configured SessionFactory: null
10:18:32,270 INFO Configuration:584 - processing one-to-many association mappings
10:18:32,270 INFO Configuration:593 - processing one-to-one association property references
10:18:32,270 INFO Configuration:618 - processing foreign key constraints
10:18:32,317 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
10:18:32,317 INFO SettingsFactory:62 - Use outer join fetching: true
10:18:32,332 INFO NamingHelper:26 - JNDI InitialContext properties:{}
10:18:32,364 INFO DatasourceConnectionProvider:51 - Using datasource: java:comp/env/jdbc/cav
10:18:32,364 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
10:18:32,504 INFO SettingsFactory:89 - Use scrollable result sets: true
10:18:32,504 INFO SettingsFactory:90 - JDBC 2 max batch size: 15
10:18:32,504 INFO SettingsFactory:99 - Query language substitutions: {}
10:18:32,504 INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
O que há de errado?
Valeu.
Gleison