日期:2014-05-17  浏览次数:20754 次

hibernate.cfg.xml的问题
Java code

package tc;

import java.util.Iterator;
import org.hibernate.cfg.Configuration;

public class GetTableName {
    public void show(){        
        Configuration cf = new Configuration();
        Iterator it = cf.getTableMappings();
        while(it.hasNext()){
            String s = (String)it.next();
            System.out.println(s);
        }
    }
    
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
    }

}


再myeclipse中写上面的类,没有报错,但是再web工程中的实际运行后提示错误 在行 Configuration cf = new Configuration();
报错,提示为java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
这是为什么

------解决方案--------------------
hibernate.jar你导入了没有
------解决方案--------------------
探讨

我是用myeclipse自动搭建hibernate框架的,再build path 的libraries中也能看到hibernate3.jar,只是再myeclipse的安装目录下面,不是再应用程序里面,这样是不是有问题