启动tomcat 后出现如下错误:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext

 resource[/WEBINF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException:

 entity class not found: com.nit.ssh.entities.User


第一步:

检查一下  *.hbm.xml 文件 class 的 name 属性填写是否正确,即关联的实体类的路径


使用Hibernate出现nested exception is org.hibernate.MappingException: entity class not found:问题


第二步:检查tomcat 是否与项目同步,及找到

 Work Space\

.metadata\

.plugins\

org.eclipse.wst.server.core\

tmp0\

wtpwebapps\

SSHProject\

WEB-INF\classes\com\nit\ssh\entities 目录下,查看是有实体类的.class 文件,如下图:


使用Hibernate出现nested exception is org.hibernate.MappingException: entity class not found:问题

如果没有,说明没有同步,在Eclipse中clean 一下


使用Hibernate出现nested exception is org.hibernate.MappingException: entity class not found:问题


第三步:检查下hibernate.cfg.xml中是否配置了相关的 *.hbm.xml ,如果是整合spring,可以在Spring配置文件中

使用Hibernate出现nested exception is org.hibernate.MappingException: entity class not found:问题


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-06-14
  • 2021-06-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-11-01
相关资源
相似解决方案