Org.apache.ibatis.binding.BindingException:Invalid bound statement (not found) New Exception solution _ Solution

Source: Internet
Author: User
Tags aop

The

First exception is as follows:

Org.apache.ibatis.binding.BindingException:Invalid bound statement (not found): Com.threegrand.urdm.system.dao.UserDao.saveUser at Org.apache.ibatis.binding.mappermethod$sqlcommand.<init > (mappermethod.java:184) at org.apache.ibatis.binding.mappermethod.<init> (mappermethod.java:38) at Org.ap Ache.ibatis.binding.MapperProxy.cachedMapperMethod (mapperproxy.java:49) at Org.apache.ibatis.binding.MapperProxy.invoke (mapperproxy.java:42) at Com.sun.proxy. $Proxy 19.saveUser (Unknown Source) at Com.threegrand.urdm.system.service.UserService.saveUser (userservice.java:20) at Com.threegrand.urdm.sys tem.service.userservice$ $FastClassBySpringCGLIB $ $caacda 27.invoke (<generated>) at Org.springframework.cglib.proxy.MethodProxy.invoke (methodproxy.java:204) at
    Org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint (CglibAopProxy.java:717) At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java:157) at org.springframework.transaction.interceptor.transactioninterceptor$1. Proceedwithinvocation (transactioninterceptor.java:98) at Org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction ( transactionaspectsupport.java:266) at Org.springframework.transaction.interceptor.TransactionInterceptor.invoke ( transactioninterceptor.java:95) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed ( reflectivemethodinvocation.java:179) at Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke ( exposeinvocationinterceptor.java:92) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed ( reflectivemethodinvocation.java:179) at org.springframework.aop.framework.cglibaopproxy$ Dynamicadvisedinterceptor.intercept (cglibaopproxy.java:653) at com.threegrand.urdm.system.service.userservice$$ Enhancerbyspringcglib$$33d9263b.saveuser (<generated>) at COM.THREEGRAND.URDM.UserService.  Userservicetest.testadd (userservicetest.java:35) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) at Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:47) at Org.junit.internal.runners.model.ReflectiveCallable.run (Reflectivecallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:44) ....

The

appeared yesterday afternoon, the first time I encountered this error, very magical and online experience is different, their solution I have tested all over, or not to make:
Scenario One
Scenario two
Scenario three
I was inspired primarily by the next two scenarios, first looking at my configuration,
I am using the mybatisrepository annotation to inject the MyBatis interface:

 <!--mybatis configuration--> <bean id= "SqlSessionFactory1" class= "Org.mybatis.spring.SqlSessionFactoryBean" > <property name= "DataSource" ref= "DataSource/> <property name=" configlocation "value=" classpath: /mybatis/configuration-mybatis.xml "/> <!--explicitly specify Mapper file location--> <property name=" Mapperlocations " > <list> <value>classpath*:/mapper/UserDao.xml</value> </l
                ist> </property> <property name= "Configurationproperties" > <props> <!--the Mapunderscoretocamelcase property maps the underscore of the column name in the table to the hump name of the JavaBean property, which defaults to false--> <prop key= "map Underscoretocamelcase ">true</prop> </props> </property> </bean> 

Before using MyBatis plugins to troubleshoot all potential bugs, of course there was a startup log, and the project was rewritten, and every configuration that could have been wrong was checked, but it still didn't, and I put the XML file and the DAO interface in a package name and then let the annotations scan for dynamic proxies, But still can't find the problem, I use debug mode to simulate method calls or not. I heard that to put the XML file in the Config-mybatis.xml in the mappers, but still not good, in the idea of the code resource file and test resource files are tried, not good, very bad appearance, I talked with another friend, but no results.

The mapper mapping file was later placed in the resource directory and scanned to make it even.
As shown in figure:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.