最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決Maven項(xiàng)目中 Invalid bound statement 無效的綁定問題

 更新時(shí)間:2021年06月15日 08:59:06   作者:偉大的格爾夫斯  
這篇文章主要介紹了解決Maven項(xiàng)目中 Invalid bound statement 無效的綁定問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

問題

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

問題

關(guān)于這個(gè)問題,我的是 Maven 項(xiàng)目,在訪問程序的接口時(shí),拋出異常信息,無效的綁定語句。

在檢查調(diào)用的 Mapper 接口時(shí),發(fā)現(xiàn)在目標(biāo)文件中沒有找到 Mapper 映射的配置文件,在項(xiàng)目的 target 目標(biāo)文件中可以看到,與接口對(duì)應(yīng)的 Mapper 文件未加載,所以在程序啟動(dòng)時(shí),就找不到對(duì)應(yīng)的映射文件,導(dǎo)致的這個(gè)錯(cuò)誤。

解決方法

在 pom 配置文件中鍵入<build> 節(jié)點(diǎn),并指明資源類型,這樣在程序啟動(dòng)時(shí),就可以正確加載配置文件了:

Java中的配置資源類型:

<build> 
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

Resource中的配置資源類型:

<build> 
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

當(dāng)然項(xiàng)目需求可以同時(shí)鍵入兩個(gè):

<build> 
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

鍵入<build> 節(jié)點(diǎn)后,在次啟動(dòng)項(xiàng)目,在項(xiàng)目的 target 目標(biāo)文件中,就可以看到接口對(duì)應(yīng)的映射文件了,問題解決咯!?。。?/p>

開發(fā)maven時(shí)遇到無效的綁定語句(未找到),org.apache.ibatis.binding.BindingException:

今天做一個(gè)springmvc+mybatis的maven項(xiàng)目時(shí)運(yùn)行登錄時(shí)報(bào)錯(cuò),顯示找不到綁定語句

日志文件如下

嚴(yán)重 [http-nio-8080-exec-9] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [crm] in context with path [/boot_crm_war] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.itheima.core.dao.UserDao.findUser] with root cause
 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.itheima.core.dao.UserDao.findUser
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:230)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
	at com.sun.proxy.$Proxy15.findUser(Unknown Source)
	at com.itheima.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:20)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy19.findUser(Unknown Source)
	at com.itheima.core.web.controller.UserController.login(UserController.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

我按照網(wǎng)上的方法怎么看都沒發(fā)現(xiàn)自己有錯(cuò)誤,很煩惱。但是他說找不到綁定語句,我明明綁定語句沒有錯(cuò)誤,為什么找不到呢?于是我去target文件夾看看我的classes有沒有編譯出來,看了之后一目了然。

在這里插入圖片描述

我們的class文件被編譯了,但是綁定語句xml文件沒有被編譯。

在做maven項(xiàng)目時(shí),以后都要注意一個(gè)點(diǎn),要在build標(biāo)簽里加上這個(gè)語句

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

xml文件才能夠被編譯。加入之后重新編譯,文件夾就多了xml文件。

在這里插入圖片描述

問題解決。

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • IKAnalyzer結(jié)合Lucene實(shí)現(xiàn)中文分詞(示例講解)

    IKAnalyzer結(jié)合Lucene實(shí)現(xiàn)中文分詞(示例講解)

    下面小編就為大家?guī)硪黄狪KAnalyzer結(jié)合Lucene實(shí)現(xiàn)中文分詞(示例講解)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-10-10
  • SpringCloudAlibaba微服務(wù)調(diào)用組件OpenFeign的方法

    SpringCloudAlibaba微服務(wù)調(diào)用組件OpenFeign的方法

    Feign是Netflix開發(fā)的聲明式、模板化的HTTP客戶端,其靈感來自Retrofit、JAXRS-2.0以及WebSocket,Feign可幫助我們更加便捷、優(yōu)雅地調(diào)用HTTP API,這篇文章主要介紹了SpringCloudAlibaba微服務(wù)調(diào)用組件OpenFeign,需要的朋友可以參考下
    2024-07-07
  • Springboot集成Quartz實(shí)現(xiàn)定時(shí)任務(wù)代碼實(shí)例

    Springboot集成Quartz實(shí)現(xiàn)定時(shí)任務(wù)代碼實(shí)例

    這篇文章主要介紹了Springboot集成Quartz實(shí)現(xiàn)定時(shí)任務(wù)代碼實(shí)例,任務(wù)是有可能并發(fā)執(zhí)行的,若Scheduler直接使用Job,就會(huì)存在對(duì)同一個(gè)Job實(shí)例并發(fā)訪問的問題,而JobDetail?&?Job方式,Scheduler都會(huì)根據(jù)JobDetail創(chuàng)建一個(gè)新的Job實(shí)例,這樣就可以規(guī)避并發(fā)訪問問題
    2023-09-09
  • Spring Cloud動(dòng)態(tài)配置刷新@RefreshScope與@Component的深度解析

    Spring Cloud動(dòng)態(tài)配置刷新@RefreshScope與@Component的深度解析

    在現(xiàn)代微服務(wù)架構(gòu)中,動(dòng)態(tài)配置管理是一個(gè)關(guān)鍵需求,Spring Cloud 提供了 @RefreshScope 注解,允許應(yīng)用在運(yùn)行時(shí)動(dòng)態(tài)更新配置,而無需重啟服務(wù),本文深入探析Spring Cloud動(dòng)態(tài)配置刷新@RefreshScope與@Component,感興趣的朋友一起看看吧
    2025-04-04
  • Spring Cache的基本使用與實(shí)現(xiàn)原理詳解

    Spring Cache的基本使用與實(shí)現(xiàn)原理詳解

    緩存是實(shí)際工作中非經(jīng)常常使用的一種提高性能的方法, 我們會(huì)在很多場(chǎng)景下來使用緩存。下面這篇文章主要給大家介紹了關(guān)于Spring Cache的基本使用與實(shí)現(xiàn)原理的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2018-05-05
  • SpringBoot事件機(jī)制相關(guān)知識(shí)點(diǎn)匯總

    SpringBoot事件機(jī)制相關(guān)知識(shí)點(diǎn)匯總

    這篇文章主要介紹了SpringBoot事件機(jī)制相關(guān)知識(shí)點(diǎn)匯總,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-09-09
  • java客戶端Etcd官方倉庫jetcd中KeepAlive接口實(shí)現(xiàn)

    java客戶端Etcd官方倉庫jetcd中KeepAlive接口實(shí)現(xiàn)

    這篇文章主要為大家介紹了java客戶端Etcd官方倉庫jetcd中KeepAlive接口實(shí)現(xiàn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,多多加薪
    2022-02-02
  • SpringBoot集成yitter-idgenerator(雪花漂移)分布式Id自增的實(shí)現(xiàn)

    SpringBoot集成yitter-idgenerator(雪花漂移)分布式Id自增的實(shí)現(xiàn)

    本文主要介紹了SpringBoot集成yitter-idgenerator(雪花漂移)分布式Id自增的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-01-01
  • Java的main方法使用及說明

    Java的main方法使用及說明

    這篇文章主要介紹了Java的main方法使用及說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • 解決springcloud中Feign導(dǎo)入依賴為unknow的情況

    解決springcloud中Feign導(dǎo)入依賴為unknow的情況

    這篇文章主要介紹了解決springcloud中Feign導(dǎo)入依賴為unknow的情況,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-03-03

最新評(píng)論

青田县| 临清市| 偃师市| 绍兴市| 万载县| 成都市| 双峰县| 阳新县| 淮阳县| 石城县| 凌源市| 汾西县| 改则县| 冷水江市| 临澧县| 全南县| 辽阳市| 清苑县| 马龙县| 蒙城县| 乐东| 浮梁县| 盐池县| 资溪县| 洛隆县| 句容市| 保靖县| 民乐县| 政和县| 井研县| 怀来县| 宜春市| 个旧市| 静乐县| 安图县| 九江县| 临湘市| 新田县| 新龙县| 堆龙德庆县| 阳江市|