No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with name 

Posted 沐昱

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with name 相关的知识,希望对你有一定的参考价值。

控制台一直报No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with name ‘SpringMVC‘,最后发现是controller没有扫描到

造成的,我这边是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:context="http://www.springframework.org/schema/context" 
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"  
    xmlns:jee="http://www.springframework.org/schema/jee" 
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-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/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
    <!-- 组件扫描 -->
    <!-- base-package:根包 -->
    <context:component-scan 
        base-package="cn.tedu.spring" />

    
</beans>

 

以上是关于No mapping found for HTTP request with URI [/spring_liu/hello.do] in DispatcherServlet with name 的主要内容,如果未能解决你的问题,请参考以下文章

WARN PageNotFound: No mapping found for HTTP request with URI

关于No mapping found for HTTP request with URI...

java springmvc No mapping found for HTTP request with URI

springmvc搭建环境时报No mapping found for HTTP request with URI [/exam3/welcome] in DispatcherServlet with

No mapping found for HTTP request with URI [/HelloWeb/] in DispatcherServlet with name 'HelloWeb

为啥 Spring MVC 以 404 响应并报告“No mapping found for HTTP request with URI [...] in DispatcherServlet”?