Mybatis: Invalid bound statement (not found), mybatisbound

Source: Internet
Author: User

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>

 

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.