亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

解決Maven項目中 Invalid bound statement 無效的綁定問題

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

問題

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

問題

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

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

解決方法

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

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)然項目需求可以同時鍵入兩個:

<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é)點后,在次啟動項目,在項目的 target 目標文件中,就可以看到接口對應(yīng)的映射文件了,問題解決咯?。。?!

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

今天做一個springmvc+mybatis的maven項目時運行登錄時報錯,顯示找不到綁定語句

日志文件如下

嚴重 [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)自己有錯誤,很煩惱。但是他說找不到綁定語句,我明明綁定語句沒有錯誤,為什么找不到呢?于是我去target文件夾看看我的classes有沒有編譯出來,看了之后一目了然。

在這里插入圖片描述

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

在做maven項目時,以后都要注意一個點,要在build標簽里加上這個語句

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

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

在這里插入圖片描述

問題解決。

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

相關(guān)文章

  • JavaSE一維數(shù)組和二維數(shù)組用法詳解

    JavaSE一維數(shù)組和二維數(shù)組用法詳解

    數(shù)組存儲同一種數(shù)據(jù)類型多個元素的集合,既可以存儲基本數(shù)據(jù)類型,也可以存儲引用數(shù)據(jù)類型,這篇文章主要給大家介紹了關(guān)于JavaSE一維數(shù)組和二維數(shù)組用法的相關(guān)資料,需要的朋友可以參考下
    2024-04-04
  • Java語言的11大特點(Java初學(xué)者必知)

    Java語言的11大特點(Java初學(xué)者必知)

    Java是一種簡單的,面向?qū)ο蟮?,分布式的,解釋型的,健壯安全的,結(jié)構(gòu)中立的,可移植的,性能優(yōu)異、多線程的靜態(tài)語言。這篇文章主要介紹了Java語言的11大特點,需要的朋友可以參考下
    2020-07-07
  • SpringMvc微信支付回調(diào)示例代碼

    SpringMvc微信支付回調(diào)示例代碼

    微信一直是一個比較熱門的詞匯,今天這篇文章主要介紹的是SpringMvc微信支付回調(diào)的示例代碼,對大家開發(fā)微信支付具有一定的參考借鑒價值,下面來一起看看吧。
    2016-09-09
  • SpringSecurity OAtu2+JWT實現(xiàn)微服務(wù)版本的單點登錄的示例

    SpringSecurity OAtu2+JWT實現(xiàn)微服務(wù)版本的單點登錄的示例

    本文主要介紹了SpringSecurity OAtu2+JWT實現(xiàn)微服務(wù)版本的單點登錄的示例,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-05-05
  • JAVA破壞單例模式的方式以及避免方法

    JAVA破壞單例模式的方式以及避免方法

    這篇文章主要介紹了JAVA破壞單例模式的方式以及避免方法,文中講解非常細致,代碼幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下
    2020-06-06
  • Hibernate映射之基本類映射和對象關(guān)系映射詳解

    Hibernate映射之基本類映射和對象關(guān)系映射詳解

    這篇文章主要介紹了Hibernate映射之基本類映射和對象關(guān)系映射詳解,非常具有實用價值,需要的朋友可以參考下
    2017-05-05
  • java 中RandomAccess接口源碼分析

    java 中RandomAccess接口源碼分析

    這篇文章主要介紹了java 中RandomAccess接口源碼分析的相關(guān)資料,需要的朋友可以參考下
    2017-05-05
  • SpringBoot?屬性配置中獲取值的方式

    SpringBoot?屬性配置中獲取值的方式

    這篇文章主要介紹了SpringBoot?屬性配置中獲取值的方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-02-02
  • Java并發(fā)之條件阻塞Condition的應(yīng)用代碼示例

    Java并發(fā)之條件阻塞Condition的應(yīng)用代碼示例

    這篇文章主要介紹了Java并發(fā)之條件阻塞Condition的應(yīng)用代碼示例,分享了相關(guān)代碼示例,小編覺得還是挺不錯的,具有一定借鑒價值,需要的朋友可以參考下
    2018-02-02
  • IntelliJ IDEA2020.3詳細安裝教程

    IntelliJ IDEA2020.3詳細安裝教程

    這篇文章主要介紹了IntelliJ IDEA2020.3詳細安裝教程,本文通過圖文并茂的形式給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-12-12

最新評論