Bom dia galera,
estou estudando Hibernate através do livro [Programação Java para Web], porém cheguei em um determinado ponto onde efetuei todos os passos do livro e ocorre um erro.
15/12/2011 08:21:37 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\eclipse-jee\eclipse\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/eclipse-jee/eclipse/jre/bin/client;C:/eclipse-jee/eclipse/jre/bin;C:/eclipse-jee/eclipse/jre/lib/i386;C:\Arquivos de programas\QuickTime\QTSystem\;%AXIS2_HOME%\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\wbem;C:\Arquivos de programas\Microsoft SQL Server\100\Tools\Binn\;C:\Arquivos de programas\Microsoft SQL Server\100\DTS\Binn\;C:\Arquivos de programas\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\eclipse-jee\eclipse;
15/12/2011 08:21:37 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:olamundo' did not find a matching property.
15/12/2011 08:21:37 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:X9System' did not find a matching property.
15/12/2011 08:21:37 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FinanceiroWeb' did not find a matching property.
15/12/2011 08:21:37 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
15/12/2011 08:21:37 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 661 ms
15/12/2011 08:21:37 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
15/12/2011 08:21:37 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.33
15/12/2011 08:21:38 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.0.6 (FCS FCS) para o contexto '/FinanceiroWeb'
15/12/2011 08:21:39 org.apache.catalina.core.StandardContext filterStart
GRAVE: Exception starting filter conexaoFilter
java.lang.NoClassDefFoundError: Lorg/hibernate/SessionFactory;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:181)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: org.hibernate.SessionFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 22 more
15/12/2011 08:21:39 org.apache.catalina.core.StandardContext start
GRAVE: Error filterStart
15/12/2011 08:21:39 org.apache.catalina.core.StandardContext start
GRAVE: Context [/FinanceiroWeb] startup failed due to previous errors
15/12/2011 08:21:39 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
GRAVE: The web application [/FinanceiroWeb] created a ThreadLocal with key of type [javax.faces.context.FacesContext$1] (value [javax.faces.context.FacesContext$1@9903f4]) and a value of type [com.sun.faces.config.InitFacesContext] (value [com.sun.faces.config.InitFacesContext@1d2b9b7]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
15/12/2011 08:21:39 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
GRAVE: The web application [/FinanceiroWeb] created a ThreadLocal with key of type [com.sun.faces.util.Util$1] (value [com.sun.faces.util.Util$1@19ecd80]) and a value of type [java.util.HashMap] (value [{com.sun.faces.patternCache={ = }}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
15/12/2011 08:21:40 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.0.6 (FCS FCS) para o contexto '/X9System'
15/12/2011 08:21:41 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
15/12/2011 08:21:41 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
15/12/2011 08:21:41 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/46 config=null
15/12/2011 08:21:41 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3657 ms
Esse é meu web.xml
<?xml version="1.0"?>
<web-app 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>FinanceiroWeb</display-name>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>conexaoFilter</filter-name>
<filter-class>financeiro.web.filter.ConexaoHibernateFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>conexaoFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-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>
e o ConexaoHibernateFilter.java
package financeiro.web.filter;
import javax.servlet.*;
import org.hibernate.SessionFactory;
import financeiro.util.HibernateUtil;
public class ConexaoHibernateFilter implements Filter {
private SessionFactory sf;
public void init(FilterConfig config) throws ServletException {
this.sf = HibernateUtil.getSessionFactory();
}
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain chain)
throws ServletException {
try {
this.sf.getCurrentSession().beginTransaction();
chain.doFilter(servletRequest, servletResponse);
this.sf.getCurrentSession().getTransaction().commit();
this.sf.getCurrentSession().close();
} catch (Throwable ex) {
try {
if (this.sf.getCurrentSession().getTransaction().isActive()) {
this.sf.getCurrentSession().getTransaction().rollback();
}
} catch (Throwable t) {
t.printStackTrace();
}
throw new ServletException(ex);
}
}
public void destroy() {
}
}
Se alguem puder me ajudar agradeço, ontem passei o dia todo pesquisando e tentanto resolver.