默认是“hibernate.cfg.xml”
所以你得使用
"config/hibernate.cfg.xml" 就可以了!
所以你得使用
"config/hibernate.cfg.xml" 就可以了!
解决方案 »
- 请求帮忙!程序的配置调用
- No result defined for action com.score.student.action.StudentAction and result i
- 请教有经验的JMS前辈指点一下啊!!
- Myeclipse中web工程引用java工程的问题
- Hibernate 3.0 设置数据源 急!
- HTML:MESSAGES和HTML:ERRORS精妙用法
- 用过webwork的高手请进来:请教webwork的<textfield>
- hibernate 小问题 新手求解答
- 实习就业选择,大家帮我顶起啊
- 原来在tomcat下移植到weblogic7.0下
- 为什么选择Java?
- struts2 标签应用问题
org.hibernate.HibernateException: config/hibernate.cfg.xml not found
org.hibernate.HibernateException: /config/hibernate.cfg.xml not found
org.hibernate.HibernateException: /WEB-INF/config/hibernate.cfg.xml not foundHibernateSessionFactory在classes文件夹的com.xxx.hibernate包里
=====================================================================================
你不是说放到WEB-INF/config/目录里面的么?
这个异常怎么报在里面没找到?
我用
new Configuration().configure("config/hibernate.cfg.xml")
new Configuration().configure("/config/hibernate.cfg.xml")
new Configuration().configure("/WEB-INF/config/hibernate.cfg.xml")
这些路径都找不到
要不然把config文件夹都放在src目录下
所以就应该是:/config/hibernate.cfg.xml
new Configuration().configure("config/hibernate.cfg.xml") ;
new Configuration().configure(path);
this is a web project dao shu ru fa tu ran mei le
public SessionFactory getSessionFacory(String configPath){
Configuration con = new Configuration().configur(configPath+"/WEB-INF/config/hibernate.cfg.xml");
SessionFactory sessionFactory = con.buildSessionFactory();
}
configPath就是从表现层传到数据访问层!
其中 在表现层configPath = request.getContextPath();