当前位置: 代码迷 >> Java Web开发 >> hibernate.cfg.xml的有关问题
  详细解决方案

hibernate.cfg.xml的有关问题

热度:8459   发布时间:2013-02-25 21:18:57.0
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的安装目录下面,不是再应用程序里面,这样是不是有问题
  相关解决方案