Mybatis Plus报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

项目是Spring boot项目,使用了Mybatis Plus,报错:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

解决办法是:

修改application.yml配置:

mybatis-plus:
  mapper-locations: classpath*:com/mycompany/business/dao/xml/*.xml

然后,在Pom文件里面增加:

<build>      
     <resources>
            <resource>
                <directory>src/main/webapp</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
</build>

 

注意,这一步如果配置成了:

<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
    </resource>
</resources>

则会导致Spring cloud项目跟Nacos有关的报错,跟让人头疼的是Windows上可能正常但是在Linux上则会报错:

2020-02-23 15:04:42.080 ERROR [-,,,] 179898 --- [           main] c.a.cloud.nacos.NacosConfigProperties    : create config service error!properties=NacosConfigProperties{serverAddr='null', encode='null', group='DEFAULT_GROUP', prefix='null', fileExtension='properties', timeout=3000, endpoint='null', namespace='null', accessKey='null', secretKey='null', contextPath='null', clusterName='null', name='null', sharedDataids='null', refreshableDataids='null', extConfig=null},e=,

com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationTargetException
        at com.alibaba.nacos.api.config.ConfigFactory.createConfigService(ConfigFactory.java:45) ~[nacos-api-1.1.1.jar!/:na]
        at com.alibaba.nacos.api.NacosFactory.createConfigService(NacosFactory.java:43) ~[nacos-api-1.1.1.jar!/:na]
        at com.alibaba.cloud.nacos.NacosConfigProperties.configServiceInstance(NacosConfigProperties.java:346) ~[spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration.nacosConfigHealthIndicator(NacosConfigEndpointAutoConfiguration.java:55) [spring-cloud-alibaba-nacos-config-2.1.0.RELEASE.jar!/:2.1.0.RELEASE]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]

  截图如下:

 

 

 

 

 

 

 

 

 

 

 

另一个链接:
http://shangshiwendao.com/article/61













posted @ 2020-02-23 15:28  寻水的鱼001  阅读(1068)  评论(0编辑  收藏  举报