springmvc搭建环境时报No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with name 'spring2'
项目是使用spring MVC
(1)在浏览器中访问,后台总报错:
- No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with name 'spring2'
查了好半天,才发现是controller 没有扫描到。
我是使用的注解。
spring mvc配置文件如下:
- <?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: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.2.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.2.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"
- >
- <!-- HandlerMapping -->
- <bean
- class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
- <!-- HandlerAdapter -->
- <bean
- class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
- <!-- ViewResolver -->
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="viewClass"
- value="org.springframework.web.servlet.view.JstlView" />
- <property name="prefix" value="/WEB-INF/jsp/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <mvc:annotation-driven />
- <!-- 处理器 -->
- <!-- <bean name="/hello" class="com.mvc.jn.controller.HelloWorldController"/> -->
- <context:component-scan base-package="com"/>
- </beans>
controller 的目录结构如下:
(2)这个问题解决之后,又报错:
No mapping found for HTTP request with URI [/exam3/WEB-INF/jsp/welcome.jsp] in DispatcherServlet with name 'spring2'
结果发现是web.xml配置得有问题,下面是有问题的:
- <servlet>
- <servlet-name>spring2</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>spring2</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
解决方法:把url-pattern 由/* 改为/
springmvc搭建环境时报No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with name 'spring2'的更多相关文章
- springmvc报404错误No mapping found for HTTP request with URI [/mavenSpringmvc/requesttest] in DispatcherServlet with name 'spring'
问题404错误的原因有很多种 有这种,后边不带url的 这种一般就是没有进入到controller中 可以在toncat中看到信息 十一月 12, 2018 12:21:25 下午 org.sprin ...
- Servlet3模块化应用中,@Controller没有被注入,导致出现:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'
问题描述:Servlet3模块化应用中,@Controller没有被注入,导致出现: org.springframework.web.servlet.DispatcherServlet noHandl ...
- Swagger 报错 no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet with name '***'
swagger报错: no mapping found for http request with uri [/***/swagger-ui.html] in dispatcherservlet wi ...
- <context:annotation-config/>和<mvc:annotation-driven/>及解决No mapping found for HTTP request with URI [/role/getRole] in DispatcherServlet with name 'springmvc-config'
1:什么时候使用<context:annotation-config> 当你使用@Autowired,@Required,@Resource,@PostConstruct,@PreDest ...
- No mapping found for HTTP request with URI [/Portal/download] in DispatcherServlet with name 'springmvc'
本文为博主原创,未经允许不得转载: 遇到这个异常,总结一下这个问题发生的原因: 这个原因是在springmvc中在DispatcherServlet分发请求时,解析不到相应的请求路径.后台要请求的路径 ...
- springmvc No mapping found for HTTP request with URI in Dispatc
springmvc No mapping found for HTTP request with URI in Dispatc 博客分类: Java Web springmvcspring MVCNo ...
- No mapping found for HTTP request with URI [/jiaoyu/student/add] in DispatcherServlet with name 'SpringMVC'
项目是使用spring MVC (1)在浏览器中访问,后台总报错: No mapping found for HTTP request with URI [/exam3/welcome] in Dis ...
- 相对路径获取项目文件 及报错 No mapping found for HTTP request with URI XXX in DispatcherServlet with name ‘springmvc’解决方法
首先一点,WebRoot目录下的文件是都可以通过浏览器输入路径,直接读取到的 例如这样: 而WebRoot下面WEB-INF是无法浏览器输入路径直接读取的. 因为是受保护的. 如果jsp读取一个图片的 ...
- No mapping found for HTTP request with URI [/crmcrmcrm/css/bootstrap.min.css] in DispatcherServlet with name 'springMvc'
先把错误贴上来 No mapping found for HTTP request with URI [/crmcrmcrm/css/sb-admin-2.css] in DispatcherServ ...
随机推荐
- mysql性能测试(索引)
首先,使用Talend随机生成一千万条数据: 数据库表中现在有1千万+的数据: mysql> select count(*) from zhangchao; +----------+ | cou ...
- react-navigation使用技巧
因为react-navigation之前存在的问题相对较多,本文更新会稍慢,而且,我现在项目使用的是基于它封装的react-native-router-fluxV4版本,现在也推荐给大家使用.在下 ...
- octave画心形曲线
octave是gnu出品和matlab兼容的科学计算软件,具有体积小,兼容性好,免费的优点. 心形曲线是根据函数:( x2 + y2 -1 )3 - x2y3=0 改编而成. clear all; c ...
- SPI和RAM IP核
学习目的: (1) 熟悉SPI接口和它的读写时序: (2) 复习Verilog仿真语句中的$readmemb命令和$display命令: (3) 掌握SPI接口写时序操作的硬件语言描述流程(本例仅以写 ...
- [na]ip数据包格式
IP Datagram Structure 字段名 解释 版本 IP协议的版本,目前的IP协议版本号为4,下一代IP协议版本号为6. 首部长度 IP报头的长度.固定部分的长度(20字节)和可变部分的长 ...
- postgres json
https://www.postgresql.org/docs/9.6/static/functions-json.html Search Documentation: Home → Documen ...
- 有关https安全的相关内容介绍
Https 介绍什么是Https HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道.简单讲是H ...
- 菜鸟学SSH(七)——Spring jar包详解
Struts.Hibernate.Spring这类的框架给我们开发带来非常大的好处,让我们更加快速.有效的开发.所以我们在开发中通常都会用到各种框架,每个框架都有很多jar包,每个jar都有各自不同的 ...
- Debugging the Java HotSpot VM
Open Heart Surgery: Analyzing and Debugging the Java HotSpot VM at the OS Level https://www.youtube. ...
- Oracle根据表生成系统流水号
1.建表tablewater create table TABLEWATER ( tb_id INTEGER not null, vc_table_name ), num_water_no ) )vc ...