Mybatis: Invalid bound statement (not found), mybatisbound
[Conventional solution]
If:
Org. apache. ibatis. binding. BindingException: Invalid bound statement (not found)
The general reason is that the Mapper interface does not correspond to the definition of the xml file. You need to check whether the package name, namespace, and function name can correspond to each other, I often wrote a wrong letter or two and couldn't find the error for a long time.
Follow these steps:
1: Check whether the package name of the xml file exactly corresponds to the package name of the interface.
2: Check whether the namespace of the xml file exactly corresponds to the package name of the xml file.
3: Check whether the function name corresponds
4: Remove Chinese comments from xml files
5: Add a space or blank line to the xml file and save it.
Generally, errors can be ruled out here.
[Problems I encountered]
If there is no local problem, you cannot log on after publishing to the server.
Error Log: shocould roll back transaction but cannot-no transaction available
Further positioning (by adjusting the code order): org. apache. ibatis. binding. BindingException: Invalid bound statement (not found)
[Error cause]
The * Mapper. xml file of Mybatis cannot be found in the war package.
[Solution]
Configure in pom. xml:
<Resources>
<Resource>
<Directory> src/main/java </directory>
<Shortdes>
<Include> **/*. xml </include> <! -- This configuration is indispensable; otherwise, the Mapper. xml of mybatis will be lost. -->
</Shortdes>
</Resource>
<Resource>
<Directory> src/main/resources </directory>
</Resource>
</Resources>