今天将代码打包上测试环境之后有一个接口一直报500,但是本地一模一样的代码正常。上测试环境拉了一下日志报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.risk.mapper.HXGgCountryMapper.getAllCountry.但是这个类和方法都是存在的,检查了一下xml中的namespace也能对应上,重新打包也还是一直报错。

源码

HXGgCountryMapper

public interface HXGgCountryMapper extends BaseMapper<HXGgCountry> {

    List<HXGgCountryVo> getAllCountry();
}

HxGgCountryMapper.xml

<?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.xxx.risk.mapper.HXGgCountryMapper">

    <sql id="Base_Column_List">
        countrycode, countrycname, countrytname, countryename, creatorcode, createtime, updatercode, updatetime, validdate, invaliddate, validind, remark, flag, createdby, updatedby
    </sql>

    <select id="getAllCountry" resultType="com.xxx.risk.bean.vo.HXGgCountryVo">
        select countrycode, countrycname, countrytname, countryename from hx_gg_country where validind='1' order by countrycode
    </select>
</mapper>

报错原因

经过对比,发现可能是类命名大小写与xml名不一致的问题,其中HXGgCountryMapper的HX是大写,而HxGgCountryMapper.xml是开头大写

将HXGgCountryMapper修改为HxGgCountryMapper后重新打包发现可以正常调用而不报错了