zoukankan      html  css  js  c++  java
  • Mapper.xml文件报错

    HTTP Status 500 - Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 121; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
    type Exception report message Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
    'sqlSessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 121; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。 description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 121; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:648) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107
    
    

    原因:Mapper.xml中SQL语句出错

    错误代码如下

          <!-- 执行分页查询 -->
       <select id="selectAllContacts" resultMap="BaseResultMap" parameterType="cn.ma.spring.po.Contacts" resultType="Integer">
        select * from contacts
        <include refid="Base_Column_List"></include>
    
      </select>
        
        <if test="start !=null and rows != null">
            limit #{start},#{rows}
        </if>

    修正如下:

          <!-- 执行分页查询 -->
       <select id="selectAllContacts" resultMap="BaseResultMap" parameterType="cn.ma.spring.po.Contacts" resultType="Integer">
        select * from contacts
        <include refid="Base_Column_List"></include>
        <if test="start !=null and rows != null">
            limit #{start},#{rows}
        </if>
      </select>

    总结: limit #{start},#{rows}语句应放入select 标签下

  • 相关阅读:
    mupdf-将pdf转png图片
    Teamcenter二次开发-客户端JAVA开发挂菜单HelloWorld例子
    SqlServer-导入excel表格数据
    PDFlib创建pdf文档
    计算机网络基础知识总结-转载
    到底什么是架构?回答你关于软件架构的所有疑惑。
    SQL语句-获得表的字段数量
    vue3.0---watch使用方法
    小程序picker自定义三级联动
    无法加载文件 D:Program Files odejs ode_globalvue.ps1,因为在此系统上禁止运行脚本。有关详细信息
  • 原文地址:https://www.cnblogs.com/axibug/p/12992493.html
Copyright © 2011-2022 走看看