IDEA啟動WEB專案訪問Controller一直提示錯誤:No mapping found for HTTP request with URI [xxxx] in DispatcherServlet
阿新 • • 發佈:2019-01-29
一、問題描述
在IDEA中啟動Tomcat,訪問專案
localhost:8080/GZ/dtcasehistory/getcasehistory
一直提示錯誤:
08-29 15:52:34.033 DispatcherServlet with name 'spring' processing POST request for [/GZ/dtcasehistory/getcasehistory] 08-29 15:52:34.050 Looking up handler method for path /GZ/dtcasehistory/getcasehistory 08-29 15:52:34.095 Did not find handler method for [/GZ/dtcasehistory/getcasehistory] 08-29 15:52:34.096 No mapping found for HTTP request with URI [/GZ/dtcasehistory/getcasehistory] in DispatcherServlet with name 'spring' 08-29 15:52:34.096 Successfully completed request
No mapping found for HTTP request with URI [xxxx] in DispatcherServlet 沒有該對映
二、解決方法
在spring.xml和web.xml中,查找了幾遍,都沒有發現有什麼錯誤,然後就想到了是不是IDEA的Tomcat配置有問題,開啟Idea的tomcat配置頁面:
發現我訪問的是localhost:8080/GZ/xxx,而這裡配置的並沒有GZ,所以錯誤就在這,選擇Deployment,在路徑中加入GZ
再回到上一個頁面就會發現多了一個GZ