读书人

hibernate.cfg.xml的有关问题

发布时间: 2012-06-04 14:48:03 作者: rapoo

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的安装目录下面,不是再应用程序里面,这样是不是有问题

读书人网 >Java Web开发

热点推荐