弹簧3.1.2的错误

时间:2014-11-25 13:17:43

标签: java spring

当我使用spring 3.0.1时,我的应用运行正常,

当我将其变为3.1.2时,我在收到网址时遇到错误 - http://localhost:8080/nated / migration

2014年11月25日下午6:43:02 org.springframework.web.servlet.DispatcherServlet noHandlerFound 警告:在DispatcherServlet中找不到带有URI [/ nated / migration]的HTTP请求的映射,其名称为' dispatcher'

这里是调度程序servlet -

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="

    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:component-scan base-package="com.nated.app.migration.controller" />
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/natedjsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    <mvc:resources mapping="/resources/**" location="/resources/css/" />
</beans>

请提出一些解决方案。

这是我的web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">

    <display-name>migration</display-name>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/application-context.xml</param-value>
    </context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
</web-app>

之前的应用程序运行得非常好3.0.1我改为3.1.2以支持mvc:resource,但现在它给出错误

1 个答案:

答案 0 :(得分:0)

现在它解决了我在调度程序servlet

中缺少<mvc:annotation-driven />