Erro: Cadastro com Hibernate Annotation + JSF

E ae galera blza? É o seguinte: Estou tentando fazer uns testes usando JSF + Hibernate e estou apanhando rsrs… Utilizando o Hibernate XML eu consegui persistir os dados e na hora de listar os dados deu erro. Mas não é esse problema que quero resolver neste momento.
Agora estou usando Annotations e nessa nem cadastrar eu estou conseguindo. Abaixo estão os códigos que estou usando neste exemplo e logo depois o erro que está sendo apresentado:

Obs: Estou usando o Netbeans 6.1 / testei com o eclipse e o erro é o mesmo.

hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/aluno</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">123456</property>    
    <mapping class="entidades.Aluno" />    
  </session-factory>
</hibernate-configuration>

faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<!-- O Bean Aluno -->	
	<managed-bean>
	<managed-bean-name>alunoBean</managed-bean-name>
	<managed-bean-class>controle.AlunoBean</managed-bean-class>
	<managed-bean-scope>session</managed-bean-scope>
	</managed-bean>
</faces-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>forwardToJSF.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

messages.properties

operacaoSucesso = Operação Concluída com Sucesso.
operacaoFracasso = Operação não Concluída.

util.HibernateUtil

package util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
    private static SessionFactory factory;
    static{
        Configuration conf = new AnnotationConfiguration();
        conf.configure();        
        factory = conf.buildSessionFactory();
    }
    public static Session getSession(){
        return factory.openSession();
    }
}

util.SessionUtil

package util;
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
public class SessionUtil {
    private static ResourceBundle bundle = ResourceBundle.getBundle("message", 
            FacesContext.getCurrentInstance().getViewRoot().getLocale());
    public static void addErrorMessage(String msg){
        msg = bundle.getString(msg);
        FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage(null, facesMsg);
    }
    public static void addSuccessMessage(String msg){
        msg = bundle.getString(msg);
        FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage("successInfo", facesMsg);
    }
}

entidades.Aluno

package entidades;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Aluno {
    @Id
    @GeneratedValue
    private int id;
    private String nome;
    private int idade;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }
    public void setNome(String nome) {
        this.nome = nome;
    }
    public int getIdade() {
        return idade;
    }
    public void setIdade(int idade) {
        this.idade = idade;
    }
}

controle.AlunoBean

package controle;
import entidades.Aluno;
import org.hibernate.Session;
import org.hibernate.Transaction;
import util.HibernateUtil;
import util.SessionUtil;
public class AlunoBean {
    private Aluno aluno = new Aluno();
    public Aluno getAluno() {
        return aluno;
    }
    public void setAluno(Aluno aluno) {
        this.aluno = aluno;
    }
    public String salvar(){
        //cria a sessao com o banco e a transacao...
        Session session = HibernateUtil.getSession();
        Transaction t = session.beginTransaction();
        try{
            //se tudo der certo, salva no banco de dados
            session.merge(aluno);
            t.commit();
            SessionUtil.addSuccessMessage("operacaoSucesso");
            //limpa formulario aluno
            Aluno aluno = new Aluno();
        }catch(Exception e){
            t.rollback();
            SessionUtil.addErrorMessage("operacaoFracasso");
        }finally{
            session.close();
        }
        return null;
    }
}

[b]Páginas web

cadastroAluno.jsp[/b]

<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
   <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>JSP Page</title>
    </head>
    <body>
        <f:view>
            <h:form>
                <h:panelGrid columns="3">
                    <h:outputText value="Nome" />
                    <h:inputText id="nome" value="#{alunoBean.aluno.nome}" />                    
                    <h:message for="nome" />                    
                    <h:outputText value="Idade" />
                    <h:inputText id="idade" value="#{alunoBean.aluno.idade}" />                    
                    <h:message for="idade" />                    
                </h:panelGrid>                
                <h:commandButton value="Salvar" action="#{alunoBean.salvar}" />                
            </h:form>
        </f:view>
    </body>
</html>

forwardToJSF.jsp

<jsp:forward page="cadastroAluno.jsf"/>

Aí estão os arquivos com os quais estou trabalhando. E logo abaixo o erro:

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/loader/custom/SQLQueryReturn
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
javax.faces.FacesException: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/loader/custom/SQLQueryReturn
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/hibernate/loader/custom/SQLQueryReturn
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.NoClassDefFoundError: org/hibernate/loader/custom/SQLQueryReturn
org.hibernate.cfg.annotations.QueryBinder.bindSqlResultsetMapping(QueryBinder.java:293)
org.hibernate.cfg.AnnotationBinder.bindQueries(AnnotationBinder.java:238)
org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:403)
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:353)
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265)
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
util.HibernateUtil.(HibernateUtil.java:14)
controle.AlunoBean.salvar(AlunoBean.java:24)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.el.parser.AstValue.invoke(AstValue.java:152)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

Bom, fico aguardando ajuda. Preciso fazer um sistema Diário Virtual para apresentar no TCC em janeiro e estou correndo contra o tempo. Abraço a todos e desde já agradeço.

Bom pessoal, já resolvi o problema.

t+

Poderia me informar qual foi a solução adotada? estou com o mesmo problema e o mesmo exemplo que esse que vc citou

grato.

[quote=caltras]Poderia me informar qual foi a solução adotada? estou com o mesmo problema e o mesmo exemplo que esse que vc citou

grato.[/quote]

Tem um tempinho já e não lembro qual foi a solução que eu encontrei, mas tem um site www.thiagochaves.eti.br lá vc encontrará uma video aula com 3 partes que faz um CRUD usando essas tecnologias ae e com o JSF. Qualquer coisa vc manda o fonte que eu dou uma olhada pra vc…

hehe… foi de lá que tirei o exemplo… heheh
Ele fala que não pode encontrar a classe org.hibernate.Session (mas já fiz todas as importações igual a do vídeo), to meio perdido nisso pq to estudando sozinho e sou novo nessa área de persistencia e jsf…
mas vou tentar mais, qualquer coisa eu mando o meu código se vc puder me ajudar.

valeu

[quote=caltras]hehe… foi de lá que tirei o exemplo… heheh
Ele fala que não pode encontrar a classe org.hibernate.Session (mas já fiz todas as importações igual a do vídeo), to meio perdido nisso pq to estudando sozinho e sou novo nessa área de persistencia e jsf…
mas vou tentar mais, qualquer coisa eu mando o meu código se vc puder me ajudar.

valeu[/quote]

Blza, se precisar é só postar…

Agora preciso de sua ajuda… estou enviando o código pra q vc dê uma olhada…

ALUNO.JAVA

package entidades;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class Aluno {
	@Id
	@GeneratedValue
	private int id;
	private String nome;
	private int idade;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public int getIdade() {
		return idade;
	}
	public void setIdade(int idade) {
		this.idade = idade;
	}
	
	
}

ALUNOBEAN.JAVA

package controle;

import org.hibernate.Transaction;
import org.hibernate.Session;

import util.HibernateUtil;
import util.SessionUtil;

import entidades.Aluno;



public class AlunoBean {
	private Aluno aluno = new Aluno();

	public String salvar(){
		Session session  = HibernateUtil.getSession();
		Transaction t = session.beginTransaction();
		try{
			session.merge(aluno);
			t.commit();
			SessionUtil.addSucessMessage(&quot;OperacaoSucesso&quot;);
			aluno = new Aluno();
		}catch(Exception e){
			t.rollback();
			SessionUtil.addErrorMessage(&quot;OperacaoFracasso&quot;);
		}finally{
			session.close();
		}
		return null;
	}
	public Aluno getAluno() {
		return aluno;
	}

	public void setAluno(Aluno aluno) {
		this.aluno = aluno;
	}
	
	
}

SESSION UTIL

package util;

import java.util.ResourceBundle;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class SessionUtil {
		
	private static ResourceBundle bundle = ResourceBundle.getBundle(&quot;messages&quot;,FacesContext.getCurrentInstance().getViewRoot().getLocale());
	
	public static void addErrorMessage(String msg){
		msg = bundle.getString(msg);
		FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR,msg,msg);
		FacesContext fc = FacesContext.getCurrentInstance();
		fc.addMessage(null, facesMsg);
	}
	public static void addSucessMessage(String msg){
		msg = bundle.getString(msg);
		FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,msg,msg);
		FacesContext fc = FacesContext.getCurrentInstance();
		fc.addMessage(&quot;sucessInfo&quot;, facesMsg);
	}
}

HIBERNATEUTIL

package util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

	private static SessionFactory factory;
	
	static{
		Configuration configuration = new AnnotationConfiguration();
		configuration.configure();
		factory = configuration.buildSessionFactory();
	}
	public static Session getSession(){
		return factory.openSession();
	}
}

HIBERNATE.CFG.XML

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
&lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
    &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
    &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
    &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/matricula&lt;/property&gt;
    &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
    &lt;property name="hibernate.connection.password"&gt;root&lt;/property&gt;
    
    &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
    &lt;property name="hibernate.format_sql"&gt;true&lt;/property&gt;

    &lt;property name="hibernate.hbm2dll.auto"&gt;update&lt;/property&gt;

	&lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt;
	&lt;property name="hibernate.c3p0.max_size"&gt;20&lt;/property&gt;
	&lt;property name="hibernate.c3p0.timeout"&gt;180&lt;/property&gt;
	&lt;property name="hibernate.c3p0.idle_test_period"&gt;100&lt;/property&gt;
	
	&lt;property name="hibernate.cache.provider_class"&gt;org.hibernate.cache.EhCacheProvider&lt;/property&gt;

 	&lt;mapping class="entidades.Aluno"/&gt;
 	&lt;mapping class="entidades.Curso"/&gt;
 	&lt;mapping class="entidades.Matricula"/&gt;
 	
  &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
SEVERE: java.lang.NoClassDefFoundError: org/hibernate/Session
javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/hibernate/Session
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
	at controle.AlunoBean.salvar(AlunoBean.java:17)
	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.el.parser.AstValue.invoke(AstValue.java:152)
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
	... 25 more
29/12/2008 10:14:48 com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/Session
javax.faces.FacesException: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/Session
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/hibernate/Session
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
	... 24 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
	at controle.AlunoBean.salvar(AlunoBean.java:17)
	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.el.parser.AstValue.invoke(AstValue.java:152)
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
	... 25 more
29/12/2008 10:14:48 com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@7f8922) threw exception
javax.faces.FacesException: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/Session
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.FacesException: #{alunoBean.salvar}: java.lang.NoClassDefFoundError: org/hibernate/Session
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
	... 19 more
Caused by: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/hibernate/Session
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
	... 24 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
	at controle.AlunoBean.salvar(AlunoBean.java:17)
	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.el.parser.AstValue.invoke(AstValue.java:152)
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
	... 25 more
29/12/2008 10:14:48 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NoClassDefFoundError: org/hibernate/Session
	at controle.AlunoBean.salvar(AlunoBean.java:17)
	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.el.parser.AstValue.invoke(AstValue.java:152)
	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)

agradeço se puder ajudar…

Brother posta ai os seus xmls e a sua pagina web… Outra coisa, tenta fazer esse codigo funcionar sem a sua classe SessionUtil, eu me lembro que estava com problemas com essa classe, depois foi só alegria.

Blz…

os Xmls que o cara usou no projeto dele são esses…
faces

~&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2"&gt;
	&lt;managed-bean&gt;
		&lt;managed-bean-name&gt;
		alunoBean&lt;/managed-bean-name&gt;
		&lt;managed-bean-class&gt;
		controle.AlunoBean&lt;/managed-bean-class&gt;
		&lt;managed-bean-scope&gt;
		session&lt;/managed-bean-scope&gt;
	&lt;/managed-bean&gt;

&lt;/faces-config&gt;

webxml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
  &lt;display-name&gt;SisMatricula&lt;/display-name&gt;
  &lt;welcome-file-list&gt;
    &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
    &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;!-- RICH FACES --&gt;
  	&lt;context-param&gt;
  		&lt;param-name&gt;org.richfaces.SKIN&lt;/param-name&gt;
  		&lt;param-value&gt;deepMarine&lt;/param-value&gt;
  	&lt;/context-param&gt;
  	&lt;context-param&gt;
  		&lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
  		&lt;param-value&gt;server&lt;/param-value&gt;
  	&lt;/context-param&gt;
  	&lt;filter&gt;
  		&lt;display-name&gt;Ajax4jsf Filter&lt;/display-name&gt;
  		&lt;filter-name&gt;ajax4jsf&lt;/filter-name&gt;
  		&lt;filter-class&gt;org.ajax4jsf.Filter&lt;/filter-class&gt;
  	&lt;/filter&gt;
  	&lt;filter-mapping&gt;
  		&lt;filter-name&gt;ajax4jsf&lt;/filter-name&gt;
  		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
  		&lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
  		&lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
  		&lt;dispatcher&gt;INCLUDE&lt;/dispatcher&gt;
  	&lt;/filter-mapping&gt;
  	
  &lt;!-- END --&gt;
  
  &lt;servlet&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
&lt;/web-app&gt;

página: cadastroAluno.jsp

&lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %&gt;
&lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %&gt;
&lt;%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %&gt;
&lt;%@ taglib uri="http://richfaces.org/rich" prefix="rich" %&gt;

&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Página Principal&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;f:view&gt;
			&lt;h:form&gt;
				&lt;h:outputText value="Cadastro de Alunos"&gt;&lt;/h:outputText&gt;
				&lt;rich:messages layout="table" infoLabelClass="messageInfo" errorLabelClass="messageError"&gt;
					&lt;f:facet name="infoMaker"&gt;
								
					&lt;/f:facet&gt;
					&lt;f:facet name="ErrorMaker"&gt;
								
					&lt;/f:facet&gt;
				&lt;/rich:messages&gt;
				&lt;h:panelGrid columns="3"&gt; 
					&lt;h:outputText value="Nome: "&gt;&lt;/h:outputText&gt;
					&lt;h:inputText id="Nome" value = "#{alunoBean.aluno.nome}" required="true"&gt;&lt;/h:inputText&gt;
					&lt;h:message for="Nome"&gt;&lt;/h:message&gt;
					&lt;h:outputText value="Idade: "&gt;&lt;/h:outputText&gt;
					&lt;h:inputText id="Idade" value = "#{alunoBean.aluno.idade}" required="true"&gt;&lt;/h:inputText&gt;
					&lt;h:message for="Idade"&gt;&lt;/h:message&gt;
				&lt;/h:panelGrid&gt;
				&lt;h:commandButton value="salvar" action="#{alunoBean.salvar}"&gt;&lt;/h:commandButton&gt;
			&lt;/h:form&gt;
		&lt;/f:view&gt;
	&lt;/body&gt;
&lt;/html&gt;

vou experimentar rodar sem o sessionUtil…
value

Blz cara… Consegui resolver esse problema…
na realiadade a biblioteca eu a importei para o Libraries, e na realidade eu tinha que colocar dentro da pasta WEB-INF/lib, já q é uma aplicação web.
Desconhecia isso, fui pesquisar sobre o erro, ai em outro tópico no GUJ tinha um cara explicando que nas aplicações Web têm que ser feitas dessa forma.
Mas obrigado pela atenção, e pela ajuda.
agora vou estudar mais jsf e hibernate.

valeu