No mapping found for HTTP request with URI [/operation-platform/js/displaytag.js] in DispatcherServl
来源:互联网 发布:纬创软件 福州 编辑:程序博客网 时间:2024/05/16 11:48
部署项目后程序加载或用浏览器访问时出现类似的警告,2011-01-19 10:52:51,646 WARN [org.springframework.web.servlet.PageNotFound] -<No mapping found for HTTP request with URI [/springmvc/images/1.jpg] in DispatcherServlet with name 'spring'>,主要看尖括号内部分。
问题原因:web.xml下对spring的DispatcherServlet请求url映射的配置,原配置如下:
<servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
分析原因:<servlet-mapping>的<url-pattern>/</url-pattern>把所有的请求都交给spring去处理了,而所有available的请求url都是在Constroller里使用类似@RequestMapping(value = "/login/{user}", method = RequestMethod.GET)这样的注解配置的,这样的话对js/css/jpg/gif等静态资源的访问就会得不到。
解决方法:在web.xml里添加如下的配置
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern></servlet-mapping><servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping>
解决方法2:在spring的配置文件中添加如下一行:
<mvc:default-servlet-handler/>
注意,需要是spring3.0.5以上版本
解决方法3
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory –>
<mvc:resources mapping="/resources/**" location="/resources/" cache-period="31536000"/>
这个配置告诉spring 静态资源的处理方式。
0 0
- No mapping found for HTTP request with URI [/operation-platform/js/displaytag.js] in DispatcherServl
- SSM报错:No mapping found for HTTP request with URI [/smbms/js/echarts.js] in DispatcherServlet with na
- No mapping found for HTTP request with URI [/SuperPowerfulProject/js/jquery.dataTables.js等静态资源加载
- No mapping found for HTTP request with URI [/login.do] in DispatcherServlet with name 'spring'
- No mapping found for HTTP request with URI [/cwgl/department/index] in DispatcherServlet with name
- No mapping found for HTTP request with URI[路径] in DispatcherServlet with name spring3
- 警告: No mapping found for HTTP request with URI [/Springmvc/test] in DispatcherServlet with dispatche
- No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
- No mapping found for HTTP request with URI [/index.html] in DispatcherServlet with name 'springmvc'
- No mapping found for HTTP request with URI [/springmvc/queryitems.action] in DispatcherServlet with
- 警告: No mapping found for HTTP request with URI [] in DispatcherServlet with name
- Spring : No mapping found for HTTP request with URI in DispatcherServlet with name "..."
- No mapping found for HTTP request with URI [/chart/get] in DispatcherServlet with name 'SpringMVC‘
- No mapping found for HTTP request with URI [/prjName/contro] in DispatcherServlet with name 'spring'
- No mapping found for HTTP request with URI [/index.do] in DispatcherServlet with name 'SpringMVC‘
- No mapping found for HTTP request with URI in DispatcherServlet with name 'XXX'
- No mapping found for HTTP request with URI [...] in DispatcherServlet with name '...'
- No mapping found for HTTP request with URI [/bdp/] in DispatcherServlet with name
- Swift 语言数据类型
- ACdream 1213 简单数学
- 屏幕旋转
- Android快速开发之设计通用的ListView,GridView的适配器
- 自动朗读(TTS)
- No mapping found for HTTP request with URI [/operation-platform/js/displaytag.js] in DispatcherServl
- 圆形背景TextView
- Visual Studio 2013 Professional Key
- R应用-多元线性回归
- 考取PMP的价值何在?
- java设计模式之代理模式
- JAVA 对象拷贝
- Behavior of Active Dataguard(ADG) When Apply Node Aborts/Crash (文档 ID 1613719.1)
- Java Web---HTTP应用层协议