有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

爪哇xxx。哈佛商学院。未找到xml,但它实际存在

我在运行Tomcat时出现以下错误:

Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is
org.hibernate.MappingNotFoundException: resource:
com/itheima/elec/domain/ElecText.hbm.xml not found

但它确实存在于我的项目中:

在我的Hibernate配置中,如下所示:

<session-factory>
    ...
    <mapping resource="com/itheima/elec/domain/ElecText.hbm.xml"/>
    <mapping resource="com/itheima/elec/domain/ElecCommonMsg.hbm.xml"/>
</session-factory>

我不知道问题出在哪里,有朋友能帮我吗


共 (1) 个答案

  1. # 1 楼答案

    请对域文件夹中的类使用@Annotations,这样就不需要使用hbm了。xml文件。之后在冬眠中。cfg。xml文件的使用 “是吗?”