facebook

error hibernate javax.faces.el.EvaluationException:java.lan

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253980 Reply

    ouafaa
    Member

    error hibernate javax.faces.el.EvaluationException:java.lang.NoClassDefFoundError

    ——————————————————————————–

    hello,
    i’m begining with JSF/eclipse/hibernate
    i’m using a tutorial of integration JSF and hibernate in tomcat

    i created the class BKUtilisateur1.java

    package utilisateur1;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.validator.LongRangeValidator;
    import javax.faces.validator.Validator;
    import javax.faces.validator.ValidatorException;
    import org.hibernate.HibernateException;
    import org.hibernate.MappingException;
    
    public class BKUtilisateur1 implements java.io.Serializable {
    
    private String nom="";
    private String prenom;
    private String password;
    private int isSupprimable;
    
    public void setNom ( String _nom)
    {nom=_nom;
    System.out.println("Nom saisie : "+_nom);}
    
    public String getNom()
    {return nom;}
    
    public void setPrenom ( String _prenom)
    {prenom=_prenom;}
    public String getPrenom()
    {return prenom;}
    public void setPassword ( String _password)
    {password=_password;}
    public String getPassword()
    {return password; }
    
    public void setIsSupprimable (int _isSup)
    {isSupprimable=_isSup;}
    public int getIsSupprimable()
    {return isSupprimable;}
    
    public String createUser()
    {
    BDUser util=new BDUser(nom,prenom,password,isSupprimable);
    util.createUser();
    return ("success");
    }
    public String nettoieUser()
    {
    setNom("");
    setPrenom("");
    setPassword("");
    setIsSupprimable(0);
    return ("success");
    }
    }

    the class DBUser is :

    
    package utilisateur1;
    import java.io.*;
    import org.hibernate.*;
    import org.hibernate.cfg.*;
    
    import java.util.zip.*;
    public class BDUser implements java.io.Serializable 
    {
    private String nom, prenom,password;
    private int isSupprimable;
    public BDUser ( String _nom,String _prenom,String _password,int _isSup) 
    {
    nom=_nom;
    prenom=_prenom;
    password=_password;
    isSupprimable=_isSup;
    }
    public void createUser()
    {
    Transaction tx=null;
    Session session=null;
    try
    {
    Configuration cfg = new Configuration().configure();
    SessionFactory sessionFactory = cfg.buildSessionFactory();
    
    
    if (sessionFactory == null)
    {
    System.out.println ( "session Factory est");
    }
    // ouverture de la session
    session =sessionFactory.openSession();
    // Creation d'un user
    
    tx = session.beginTransaction();
    
    Utilisateurs util1=new Utilisateurs();
    // on peuple l'objet util
    // mais pas la clé primaire, qui nous sera retournée par session.save();
    util1.setNom(this.nom);
    util1.setPrenom(this.prenom);
    util1.setPassword(this.password);
    util1.setDatecm(new java.util.Date());
    util1.setIssupprimable(this.isSupprimable);
    
    
    // on recupere la primary key
    Long id= (Long) session.save(util1);
    
    tx.commit();
    
    System.out.println("Id sauvegarde = "+id.toString());
    }
    
    catch (Exception e) {
    try
    {
    if (tx!=null) tx.rollback();
    e.printStackTrace();
    }
    catch (HibernateException he) {
    he.printStackTrace();
    }
    }
    
    finally {
    try
    {
    session.close();
    }
    catch (HibernateException he) {
    he.printStackTrace();
    }
    }}}

    when i created a JSF file that use the method createUser , i have the following error:

    javax.faces.FacesException: #{BKUtilisateur1.createUser}: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/hibernate/HibernateException

    thank you in advance

    #253989 Reply

    Haris Peco
    Member

    ouafaa ,

    You haven’t hibernate libraries in your project – I don’t sure if you need add hibernate capabilities in your project or you have some deployment problems
    for quick fix try add hibernate libraries (all from hibernate) to web application’s WEB-INF/lib

    best regards

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: error hibernate javax.faces.el.EvaluationException:java.lan

You must be logged in to post in the forum log in