1. 错误信息

Invocation of init method failed; nested exception is org.hibernate.MappingNotFoundException: resource: model/Department.hbm.xml not found
at 

2. 错误分析

(1)项目的hibernate逆向工程是用intellij的persistant工具来完成的,最终完成后,模型对象和映射文件都保存在了model的目录下。

intellij 编译 springmvc+hibernate+spring+maven  找不到hbm.xml映射文件

(2)由于我们设定了src文件夹是存放代码的,resource文件夹是存放资源的,因此intellij在编译的时候会忽略src文件夹下面的xml文件,导致最后发布的文件夹下面丢失了这些映射文件。

详情参照:http://stackoverflow.com/questions/2843949/how-to-configure-hibernate-tools-with-maven-to-generate-hibernate-cfg-xml-hbm

 

intellij 编译 springmvc+hibernate+spring+maven  找不到hbm.xml映射文件

3. 解决方案

在resource的目录下建立同目录同名的文件夹,保存相应的xml文件。

intellij 编译 springmvc+hibernate+spring+maven  找不到hbm.xml映射文件

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2021-12-21
猜你喜欢
  • 2021-10-21
  • 2021-05-01
  • 2021-10-28
  • 2021-10-30
  • 2022-02-24
  • 2022-01-31
  • 2021-12-04
相关资源
相似解决方案