背景:eclipse中的maven项目 浏览器输入localhost:8080/项目名 报404错误

检查:1.pom文件中:<build>标签下的

        <finalName>项目名</finalName>

     2.右键项目Properties 输入web 找到Web Project Settings右边Context root 是否跟项目名一致 不一致的话改掉

    如果确保以上两个都没问题但是还是访问不到的话 请看下边

       3.找到项目所在磁盘路径.project下边 <projectDescription>标签中<name>项目名</name> 检查项目名

    4. .settings 中 org.eclipse.wst.common.component这个文件    <wb-module deploy-name="项目名">

    及其下边<property name="context-root" value="项目名"/>

  另外注意:spring配置文件中 <bean id="/xxx.xxx" class="xxx.xxx" /> id 的值  我曾写成xxx.xxx 而不是 / xxx.xxx

  还好看到console中 警告: No mapping found for HTTP request with URI [/m项目名/xxx.do] in DispatcherServlet with name 'xxx' 害我找了好久!一个 / 引发的。。。

参考:https://blog.csdn.net/louyingyuan/article/details/70169224

posted on 2019-12-01 11:55  冷乐飒  阅读(474)  评论(1编辑  收藏  举报