【问题标题】:error with spring 3.1.2弹簧 3.1.2 错误
【发布时间】:2014-11-25 13:17:42
【问题描述】:

当我使用 spring 3.0.1 时,我的应用运行良好,

当我把它改成 3.1.2 现在我在点击 url-http://localhost:8080/nated/migration 时遇到错误

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

这里是调度器 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,但现在它给出错误

【问题讨论】:

    标签: java spring


    【解决方案1】:

    现在它已解决,我在调度程序 servlet 中缺少 &lt;mvc:annotation-driven /&gt;

    【讨论】:

      猜你喜欢
      • 2017-12-31
      • 2013-12-06
      • 2012-12-22
      • 2011-07-25
      • 2012-01-19
      • 1970-01-01
      • 2012-11-13
      • 2010-09-20
      • 2014-11-10
      相关资源
      最近更新 更多