meu jsp de teste…
<%
ServicoFacade servFac = new ServicoFacade();
List list = servFac.getServicos();
for(int i =0; i<list.size(); i++){
Servico serv = (Servico) list.get(i);
%>
<li><%=serv.getUrl()%></li>
<%
}
%>
meu metodo getServicos()
public List getServicos() {
Session sessao = HibernateUtility.getSession(); /
Transaction tx = sessao.beginTransaction();
Query select = sessao.createQuery("from Servico");
tx.commit();
sessao.close();
return select.list();
}
meu HibernateUtility
public class HibernateUtility {
private static SessionFactory factory;
static {
try {
factory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
} catch (Exception e) {
e.printStackTrace();
factory = null;
}
}
public static Session getSession() {
return factory.openSession();
}
}
o erro…
org.hibernate.HibernateException: hibernate.cfg.xml not found
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1087)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1111)
at hibernate.HibernateUtility.<clinit>(HibernateUtility.java:12)
at hibernate.ServicoFacade.getServicos(ServicoFacade.java:12)
at org.apache.jsp.pages.inputname_jsp._jspService(inputname_jsp.java:111)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
coloquei os xmls e os .java na mesma pasta pra evitar erro, mas mesmo assim nao seu. alguem pode ajudar??? valeu