为什么找不到HEBERNATE的类???
------------------------------------
你的类导入到lib文件夹下面没有?

解决方案 »

  1.   

    hibernate包要放在WEB-INF/lib下
    实在不行重起试试
      

  2.   

    NoClassDefFoundErrorHibernate 的配置文件设置好了吗?
      

  3.   

    你要把那些生成的类*。hbm.xml放到hibernate的配置文件里面去
      

  4.   

    以上各位说的我都作了!
    我用的是eclipse+myeclipse!
      

  5.   

    是否有对应的pojo 和相应的 .hbm.xml 文件,
    是否在 hibernate的配置文件中引入了!
    注:.xml格式的配置文件可以直接引入,
        .properties格式的配置文件需要通过程序来引入,
      

  6.   

    <?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"><!-- Generated by MyEclipse Hibernate Tools.                   -->
    <hibernate-configuration> <session-factory>
    <property name="connection.username">root</property>
    <property name="connection.url">jdbc:mysql://localhost:3306/customer</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="myeclipse.connection.profile">Customers_mysql</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <mapping resource="com/hibernate/dao/Customers.hbm.xml" />----我在这里已经引入了! </session-factory></hibernate-configuration>
      

  7.   

    com.studytest.struts.action.AddUserAction.execute(AddUserAction.java:56)看看你这一行写得什么
      

  8.   

    这一行写的是:
         usehibernate.saveCustomers(customers);saveCustomers(customers)方法是:
    public void saveCustomers(Customers customers)throws Exception{         Session session = SessionFactory.currentSession();
    Transaction tx = null;
    try{
    tx = session.beginTransaction();
    session.save(customers);
    tx.commit();
    }
    catch(Exception e){
    if(tx != null){
    tx.rollback();
    }
    throw e;
    }
    finally{
    SessionFactory.closeSession();
             }
    }SessionFactory中的currentSession():public static Session currentSession() throws HibernateException {
         Session session = (Session) threadLocal.get(); if (session == null || !session.isOpen()) {
    if (sessionFactory == null) {
    try {
    cfg.configure(CONFIG_FILE_LOCATION);
    sessionFactory = cfg.buildSessionFactory();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    session = (sessionFactory != null) ? sessionFactory.openSession()
    : null;
    threadLocal.set(session);
    }return session;
    }