使用Hibernate过程中出现entity class not found 问题的解决思路
2017-07-31 20:44
411 查看
启动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 属性填写是否正确,即关联的实体类的路径
第二步:检查tomcat 是否与项目同步,及找到
Work Space\
.metadata\
.plugins\
org.eclipse.wst.server.core\
tmp0\
wtpwebapps\
SSHProject\
WEB-INF\classes\com\nit\ssh\entities 目录下,查看是有实体类的.class 文件,如下图:
如果没有,说明没有同步,在Eclipse中clean 一下
第三步:检查下hibernate.cfg.xml中是否配置了相关的 *.hbm.xml ,如果是整合spring,可以在Spring配置文件中
上述方法仅是我个人总结的方法
严重: 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 属性填写是否正确,即关联的实体类的路径
第二步:检查tomcat 是否与项目同步,及找到
Work Space\
.metadata\
.plugins\
org.eclipse.wst.server.core\
tmp0\
wtpwebapps\
SSHProject\
WEB-INF\classes\com\nit\ssh\entities 目录下,查看是有实体类的.class 文件,如下图:
如果没有,说明没有同步,在Eclipse中clean 一下
第三步:检查下hibernate.cfg.xml中是否配置了相关的 *.hbm.xml ,如果是整合spring,可以在Spring配置文件中
上述方法仅是我个人总结的方法
相关文章推荐
- 使用Hibernate过程中出现entity class not found 问题的解决思路
- 使用Hibernate出现nested exception is org.hibernate.MappingException: entity class not found:问题
- 解决IDEA使用hibernate出现*.hbm.xml not found的问题
- 使用jstl标签过程中出现问题的解决
- VSRS_3.5使用过程中出现的问题解决
- label标签使用过程中遇到的问题分析及解决思路
- 在使用SwipeRefreshLayout的过程中出现的两个问题的解决办法
- 使用autotools工具制作Makefile过程可能出现问题与解决方式
- 电脑日常使用过程中出现的问题及解决办法
- 解决Hibernate使用HQL查询出现is not mapped问题
- Android 使用adb shell命令时出现sqlite3 : not found 问题 解决方法
- 如何解决mid使用过程中出现的以下问题(无效的过程调用或参数: 'mid')
- 解决ISE使用过程中出现 _SN.exe的问题
- 使用maven的mybatis-generator生成实例和mapping过程以及可能出现问题解决
- 解决安装使用Genymotion过程出现的一些问题
- 在使用Hibernate时,因为一个查询需要更多的表连接而要使用SQL来解决性能问题。然而返回的结果集中包含了没有映射的Entity类中的表字段,在这个SQL中还有使用如何将层次关系的父子结点显示为横行
- myeclipse 使用weblogic10启动hibernate项目时出现ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常的解决办法
- Android 使用adb shell命令时出现sqlite3 : not found 问题 解决方法
- 1.29使用hibernate链接oracle数据库出现问题并解决
- 使用hibernate心得——字符串超长的解决办法(setCharacterStream出现顺序问题)