【请教】org.springframework.web.servlet.PageNotFound - No mapping found for HTTP req

sujiangchichu 2014-05-02 09:45:23
org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/school5/newsInput.html] in DispatcherServlet with name 'b505'

**************************************************************************************************************************************
项目名:school5
**************************************************************************************************************************************
web.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>school5</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>school5</param-value>
</context-param>
<servlet>
<servlet-name>b505</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/b505-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>b505</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<filter>
<filter-name>openSession</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSession</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>60000</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
</web-app>
**************************************************************************************************************************************
b505-servlet.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<!-- 开启controller注解支持 -->
<context:component-scan base-package="com.b505.web">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<mvc:default-servlet-handler/>

<mvc:annotation-driven >
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter" >
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
<value>text/html;charset=UTF-8</value>
</list>

</property>

</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 上传图片和文件 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="104857600" />
<property name="maxInMemorySize" value="4096" />
<property name="defaultEncoding" value="UTF-8"></property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:viewClass="org.springframework.web.servlet.view.JstlView"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />


<!-- 声明DispatcherServlet不要拦截下面声明的目录 -->
<mvc:resources location="/js/" mapping="/js/**" />
<mvc:resources location="/newsimg/" mapping="/newsimg/**"/>
<mvc:resources location="/images/" mapping="/images/**"/>
<mvc:resources location="/css/" mapping="/css/**"/>
<mvc:resources location="js/themes/default/" mapping="js/themes/default/**"/>
</beans>
**************************************************************************************************************************************
尝试了:重新装MyEclipse,重新装Tomcat。在其他网站上查了很多,照着做都没有成功。
注:项目在另一台电脑上可以正常运行,在我的电脑上就不行了。又将项目移到服务器机子上也不行,现在我们的项目只能在一台机子上正常运行,好奇怪。
求教。
...全文
15652 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
botak_233 2016-12-21
  • 打赏
  • 举报
回复
引用 13 楼 csdn_ljh 的回复:
我是在请求css和js引用文件的时候报这错了,解决办法是让spring的servlet只过滤 .do后缀的请求
帮了大忙了 拜谢
chwb12345678 2016-11-14
  • 打赏
  • 举报
回复
哎呦,点错了,13楼对不起,投我个板砖得了
chwb12345678 2016-11-14
  • 打赏
  • 举报
回复
检查路径无误的话,加个绝对路径就行
轻度愉悦 2016-06-03
  • 打赏
  • 举报
回复
我是在请求css和js引用文件的时候报这错了,解决办法是让spring的servlet只过滤 .do后缀的请求

wjwei1213 2015-03-08
  • 打赏
  • 举报
回复
这个问题解决了吗?我也遇到了这个问题
chon_ye 2014-07-28
  • 打赏
  • 举报
回复
我也有这个问题
sujiangchichu 2014-05-07
  • 打赏
  • 举报
回复
引用 6 楼 rui888 的回复:
路径对不,后台进没?如果找不到的话应该所有类似的url 都会有问题
这个项目在其他电脑上完全可以跑起来的,就是在我电脑上有问题了,至今不明白问题出在哪。
sujiangchichu 2014-05-07
  • 打赏
  • 举报
回复
引用 5 楼 xuefeng0707 的回复:
是不是b505-servlet.xml里要配置一下不拦截*.html
这个项目在其他电脑上完全可以跑起来的,就是在我电脑上有问题了,至今不明白问题出在哪。
sujiangchichu 2014-05-07
  • 打赏
  • 举报
回复
引用 4 楼 wyx100 的回复:
报错信息贴出来
贴出来了啊 org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/school5/newsInput.html] in DispatcherServlet with name 'b505'
tony4geek 2014-05-06
  • 打赏
  • 举报
回复
路径对不,后台进没?如果找不到的话应该所有类似的url 都会有问题
xuefeng0707 2014-05-06
  • 打赏
  • 举报
回复
是不是b505-servlet.xml里要配置一下不拦截*.html
wyx100 2014-05-06
  • 打赏
  • 举报
回复
报错信息贴出来
sujiangchichu 2014-05-06
  • 打赏
  • 举报
回复
顶一下吧,为了苦逼的程序员,这问题太难解。
sujiangchichu 2014-05-05
  • 打赏
  • 举报
回复
引用 1 楼 defonds 的回复:
是下面的声明没有起作用?
就是这个项目,原封不动的移到其它的电脑上就可以跑起来,没有这样的问题,单单是在我的电脑上有问题。 求解,我已经重装了系统,重装了MyEclipse,重装了Tomcat,可是还是报这样的错误。
Defonds 2014-05-03
  • 打赏
  • 举报
回复
是下面的声明没有起作用?
YOLO系列是基于深度学习的端到端实时目标检测方法。 PyTorch版的YOLOv5轻量而性能高,更加灵活和易用,当前非常流行。 本课程将手把手地教大家使用labelImg标注和使用YOLOv5训练自己的数据集。课程实战分为两个项目:单目标检测(足球目标检测)和多目标检测(足球和梅西同时检测)。 本课程的YOLOv5使用ultralytics/yolov5,在Windows系统上做项目演示。包括:安装YOLOv5、标注自己的数据集、准备自己的数据集、修改配置文件、使用wandb训练可视化工具、训练自己的数据集、测试训练出的网络模型和性能统计。 希望学习Ubuntu上演示的同学,请前往 《YOLOv5(PyTorch)实战:训练自己的数据集(Ubuntu)》课程链接:https://edu.csdn.net/course/detail/30793  本人推出了有关YOLOv5目标检测的系列课程。请持续关注该系列的其它视频课程,包括:《YOLOv5(PyTorch)目标检测实战:训练自己的数据集》Ubuntu系统 https://edu.csdn.net/course/detail/30793Windows系统 https://edu.csdn.net/course/detail/30923《YOLOv5(PyTorch)目标检测:原理与源码解析》课程链接:https://edu.csdn.net/course/detail/31428《YOLOv5目标检测实战:Flask Web部署》课程链接:https://edu.csdn.net/course/detail/31087《YOLOv5(PyTorch)目标检测实战:TensorRT加速部署》课程链接:https://edu.csdn.net/course/detail/32303《YOLOv5目标检测实战:Jetson Nano部署》课程链接:https://edu.csdn.net/course/detail/32451《YOLOv5+DeepSORT多目标跟踪与计数精讲》课程链接:https://edu.csdn.net/course/detail/32669《YOLOv5实战口罩佩戴检测》课程链接:https://edu.csdn.net/course/detail/32744《YOLOv5实战中国交通标志识别》课程链接:https://edu.csdn.net/course/detail/35209《YOLOv5实战垃圾分类目标检测》课程链接:https://edu.csdn.net/course/detail/35284       

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧