开发者社区> 问答> 正文

报错信息: Invalid bound statement (not found)?报错

开发中遇到下面问题,网上的方法都试过了,就是找不出原因,请大神们指教一下!

 报错信息。

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.numberone.xr.mapper.JfmxMapper.insertJfmx
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
	at com.sun.proxy.$Proxy132.insertJfmx(Unknown Source)
	at com.numberone.xr.service.impl.JfmxServiceImpl.insertJfmx(JfmxServiceImpl.java:61)
	at com.numberone.web.controller.xr.JfmxController.addSave(JfmxController.java:247)
	at com.numberone.web.controller.xr.JfmxController$$FastClassBySpringCGLIB$$fd5f1add.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:55)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
	at com.numberone.web.controller.xr.JfmxController$$EnhancerBySpringCGLIB$$e8366a50.addSave(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

网上方法都用了。

1.检查xml文件所在package名称是否和Mapper interface所在的包名 正确。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.numberone.xr.mapper.JfmxMapper">
    
    <resultMap type="Jfmx" id="JfmxResult">
        <result property="iD"    column="ID"    />
        <result property="userID"    column="UserID"    />
        <result property="username"    column="Username"    />
        <result property="subTime"    column="sub_time"    />
        <result property="deptname"    column="deptname"    />
        <result property="deleteFlag"    column="delete_flag"    />
        <result property="source"    column="source"    />
        <result property="score"    column="Score"    />
        <result property="deptId"    column="deptId"    />
        <result property="comment"    column="comment"    />
        <result property="createByID"    column="createByID"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateByid"    column="update_byID"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
	
	<sql id="selectJfmxVo">
        select ID, UserID, Username, sub_time, deptname, delete_flag, source, Score, deptId, comment, createByID, create_by, create_time, update_byID, update_by, update_time from jfmx
    </sql>
	
    <select id="selectJfmxList" parameterType="Jfmx" resultMap="JfmxResult">
        <include refid="selectJfmxVo"/>
        <where>  
            <if test="iD != null "> and ID = #{iD}</if>
             <if test="userID != null  and userID != '' "> and UserID = #{userID}</if>
             <if test="username != null  and username != '' "> and Username = #{username}</if>
             <if test="subTime != null "> and sub_time = #{subTime}</if>
             <if test="deptname != null  and deptname != '' "> and deptname = #{deptname}</if>
             <if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if>
             <if test="source != null "> and source = #{source}</if>
             <if test="score != null "> and Score = #{score}</if>
             <if test="deptId != null  and deptId != '' "> and deptId = #{deptId}</if>
             <if test="comment != null  and comment != '' "> and comment = #{comment}</if>
             <if test="createByID != null  and createByID != '' "> and createByID = #{createByID}</if>
             <if test="createBy != null  and createBy != '' "> and create_by = #{createBy}</if>
             <if test="createTime != null "> and create_time = #{createTime}</if>
             <if test="updateByid != null  and updateByid != '' "> and update_byID = #{updateByid}</if>
             <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
             <if test="updateTime != null "> and update_time = #{updateTime}</if>
         </where>
    </select>
    
    <select id="selectJfmxById" parameterType="Integer" resultMap="JfmxResult">
        <include refid="selectJfmxVo"/>
        where ID = #{iD}
    </select>
        
    <insert id="insertJfmx" parameterType="Jfmx">
        insert into jfmx
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="iD != null  ">ID,</if>
			<if test="userID != null  and userID != ''  ">UserID,</if>
			<if test="username != null  and username != ''  ">Username,</if>
			<if test="subTime != null  ">sub_time,</if>
			<if test="deptname != null  and deptname != ''  ">deptname,</if>
			<if test="deleteFlag != null  ">delete_flag,</if>
			<if test="source != null  ">source,</if>
			<if test="score != null  ">Score,</if>
			<if test="deptId != null  and deptId != ''  ">deptId,</if>
			<if test="comment != null  and comment != ''  ">comment,</if>
			<if test="createByID != null  and createByID != ''  ">createByID,</if>
			<if test="createBy != null  and createBy != ''  ">create_by,</if>
			<if test="createTime != null  ">create_time,</if>
			<if test="updateByid != null  and updateByid != ''  ">update_byID,</if>
			<if test="updateBy != null  and updateBy != ''  ">update_by,</if>
			<if test="updateTime != null  ">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="iD != null  ">#{iD},</if>
			<if test="userID != null  and userID != ''  ">#{userID},</if>
			<if test="username != null  and username != ''  ">#{username},</if>
			<if test="subTime != null  ">#{subTime},</if>
			<if test="deptname != null  and deptname != ''  ">#{deptname},</if>
			<if test="deleteFlag != null  ">#{deleteFlag},</if>
			<if test="source != null  ">#{source},</if>
			<if test="score != null  ">#{score},</if>
			<if test="deptId != null  and deptId != ''  ">#{deptId},</if>
			<if test="comment != null  and comment != ''  ">#{comment},</if>
			<if test="createByID != null  and createByID != ''  ">#{createByID},</if>
			<if test="createBy != null  and createBy != ''  ">#{createBy},</if>
			<if test="createTime != null  ">#{createTime},</if>
			<if test="updateByid != null  and updateByid != ''  ">#{updateByid},</if>
			<if test="updateBy != null  and updateBy != ''  ">#{updateBy},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
         </trim>
    </insert>
	 
    <update id="updateJfmx" parameterType="Jfmx">
        update jfmx
        <trim prefix="SET" suffixOverrides=",">
            <if test="userID != null  and userID != ''  ">UserID = #{userID},</if>
            <if test="username != null  and username != ''  ">Username = #{username},</if>
            <if test="subTime != null  ">sub_time = #{subTime},</if>
            <if test="deptname != null  and deptname != ''  ">deptname = #{deptname},</if>
            <if test="deleteFlag != null  ">delete_flag = #{deleteFlag},</if>
            <if test="source != null  ">source = #{source},</if>
            <if test="score != null  ">Score = #{score},</if>
            <if test="deptId != null  and deptId != ''  ">deptId = #{deptId},</if>
            <if test="comment != null  and comment != ''  ">comment = #{comment},</if>
            <if test="createByID != null  and createByID != ''  ">createByID = #{createByID},</if>
            <if test="createBy != null  and createBy != ''  ">create_by = #{createBy},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateByid != null  and updateByid != ''  ">update_byID = #{updateByid},</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by = #{updateBy},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
        </trim>
        where ID = #{iD}
    </update>

	<delete id="deleteJfmxById" parameterType="Integer">
        delete from jfmx where ID = #{iD}
    </delete>
	
    <delete id="deleteJfmxByIds" parameterType="String">
        delete from jfmx where ID in 
        <foreach item="iD" collection="array" open="(" separator="," close=")">
            #{iD}
        </foreach>
    </delete>
    
</mapper>




 

展开
收起
爱吃鱼的程序员 2020-06-05 14:35:59 705 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        其他mapper有问题没?先去调他再看看是否报错,然后建个空的在看看,一点点排查咯,还有改名子啥的咯
                    
    
                        <pre><span><resultMap </span><span>id</span><span>="BaseResultMap" </span><span>type</span><span>="com.java.alibaba.bind.Dongcidaci"</span><span>>,试一下这样</span></pre>
    
    2020-06-05 14:36:17
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spark SQL: Past, Present and Future 立即下载
Spark SQL:Past Present &Future 立即下载
低代码开发师(初级)实战教程 立即下载