title: mybatis spring application getting - org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
body: <p>I know this question has been asked several times but none of the answers helped me.Hence I am asking it again. I read that this error occurs when interface class/package name is different than mapper xml's class/package. I am using the same class/package name still getting this error.</p>
  
  <p>I am using spring-mybatis and getting this exception
  org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): </p>
  
  <p>Here are my associated files:-</p>
  
  <p><strong>1)EmployeMapper.java (Interface)</strong></p>
  
  <pre><code>  com.XXX.org.mapper
          public interface EmployeeMapper {
          public Employee getEmployeeFullDetails(String employeeId);
          }
  </code></pre>
  
  <p><strong>2) com.XXX.org.mapper.EmployeeMapper.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
          &lt;!DOCTYPE mapper
          PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  
  &lt;mapper namespace="com.XXX.org.mapper.EmployeeMapper"&gt;
          &lt;select id="getEmployeeFullDetails" parameterType="String" resultType="com.XXX.org.Domain.Employee"&gt;
           SELECT * from employee emp 
           where emp.employeeId = #{employeeId}
          &lt;/select&gt;
  &lt;/mapper&gt;
  </code></pre>
  
  <p><strong>3)ApplicationContext.xml</strong></p>
  
  <pre><code>&lt;context:annotation-config/&gt;
  
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" &gt;
      &lt;property name="driverClassName" value="${dataSource.driverClassName}" /&gt;
      &lt;property name="username" value="${dataSource.username}" /&gt;
      &lt;property name="password" value="${dataSource.password}" /&gt;
      &lt;property name="url" value="${dataSource.url}" /&gt;
  &lt;/bean&gt;
  
  &lt;context:component-scan base-package="com.XXX.org"/&gt;
  
  &lt;context:annotation-config/&gt;
  
  &lt;tx:annotation-driven /&gt;
  
  
  &lt;bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" &gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="typeAliasesPackage" value="com.XXX.org.domain" /&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" &gt;
     &lt;property name="basePackage" value="com.XXX.org.mapper" /&gt;
      &lt;property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>4) DBUnit test</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:service-bean.xml"})
  @TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class})
  public class EmployeeTest {
  
      @Autowired
      EmployeeMapper employeeMapper;
  
  
  @Test
      @DatabaseSetup(value = {"/employee.xml"} , type= com.github.springtestdbunit.annotation.DatabaseOperation.CLEAN_INSERT)
      public void testInsertEmployee() {
  
        Employee employee=  employeeMapper.getEmployeeFullDetails("testUser");
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6ADjY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ADjY.png" alt="WEBINF/classes"></a></p>
  
  <p>I can see both my interface and xml mapper in WEBINF/classes but the issue is that inspite of sharing the same package name , 2 separate folders are created with same name. I  think both should be inside one package in generated classes.</p>