Pessoal estou comecando com o hibernate e estou com o sequinte erro e não como resolver
log4j:WARN No appenders could be found for logger (model.IgrejaHome).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.IllegalStateException: Could not locate SessionFactory in JNDI
at model.IgrejaHome.getSessionFactory(IgrejaHome.java:30)
at model.IgrejaHome.<init>(IgrejaHome.java:22)
at Teste.main(Teste.java:8)
web.xml
[code]<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
Curia</display-name>
<servlet>
<description>
</description>
<display-name>
Teste</display-name>
<servlet-name>Teste</servlet-name>
<servlet-class>
model.Teste</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Teste</servlet-name>
<url-pattern>/Teste</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
[/code]
classe q gera o erro
[code]public class IgrejaHome {
private static final Log log = LogFactory.getLog(IgrejaHome.class);
private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext().lookup("bunda");
}
catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException("Could not locate SessionFactory in JNDI");
}
}[/code]