美文网首页
SpringMVC + Mybatis 整合报错

SpringMVC + Mybatis 整合报错

作者: 角灯的技术博客 | 来源:发表于2017-08-25 17:40 被阅读155次

at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSession' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sqlSessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [/Users/jordan/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/teamup/WEB-INF/classes/com/springmvc/mapping/FavoritesUser.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.springmvc.entity.Favoritesusers'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.springmvc.entity.Favoritesusers
at org

最新做JavaWeb项目几次遇到这个问题
1.项目没有编译,class文件里面没有这个类

  1. 入参的 错误点:如果入参是个对象,把resultType改为resultMap

3.xxdao.xml 和  xxDao.java 里面方法的入参不相同,映射失败。
比如到里面是两个int类型的参数
public int insertFavoritesteams( int fromuserid, int teamid);
insert里面写成了User对象
<insert id="insertFavoritesteams" parameterType="com.springmvc.entity.User" >

前一段开始学JavaWeb,第一个项目用的servlet+jsp
现在用的是SpringMvc + MyBatis

相关文章

网友评论

      本文标题:SpringMVC + Mybatis 整合报错

      本文链接:https://www.haomeiwen.com/subject/xmqpdxtx.html