首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

hibernate.cfg.xml的有关问题

2012-06-04 
hibernate.cfg.xml的问题Java codepackage tcimport java.util.Iteratorimport org.hibernate.cfg.Confi

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

热点排行