org.hibernate.HibernateException: /hibernate.cfg.xml not found

前端 未结 7 1041
野趣味
野趣味 2020-12-03 15:22

I\'m trying to use hibernate with spring 3 mvc but at the moment I get this exception thrown. I think I need to define my hibernate.cfg.xml somewhere, but not s

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 16:11

    hibernate.cfg.xml must be found in the root of the classpath when the webapp is started.

    If you are using maven to build the project, put hibernate.cfg.xml in the src/main/resources directory so that when you build the war package, it will be automatically be placed in /WEB-INF/classes.

    If not using maven, place the file directly in your WEB-INF/classes directory.

提交回复
热议问题