一、问题描述
在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
本文解决了一个在IntelliJ IDEA中配置Tomcat启动项目时遇到的URL映射问题。具体表现为访问特定URL时,后台提示找不到映射处理方法。通过检查配置文件未发现明显错误,最终定位到IDEA的Tomcat部署设置中缺少相应的上下文路径。
8469

被折叠的 条评论
为什么被折叠?



