Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当我试图运行一个简单的Spring项目时,我遇到了一个错误_Java_Spring_Jsp_Model View Controller - Fatal编程技术网

Java 当我试图运行一个简单的Spring项目时,我遇到了一个错误

Java 当我试图运行一个简单的Spring项目时,我遇到了一个错误,java,spring,jsp,model-view-controller,Java,Spring,Jsp,Model View Controller,我用的是最新的弹簧罐。我创建了一个非常小的应用程序,它在JSP上呈现Hello 但是,它说我在DispatcherServlet中声明bean定义时遇到了一个问题。请帮帮我 这是我的你好控制器 package com.raghav.hellocontroller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframe

我用的是最新的弹簧罐。我创建了一个非常小的应用程序,它在JSP上呈现Hello

但是,它说我在DispatcherServlet中声明bean定义时遇到了一个问题。请帮帮我

这是我的你好控制器

package com.raghav.hellocontroller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

public class HelloController {

    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception {
    ModelAndView modelandview = new ModelAndView("HelloPage");
    modelandview.addObject("welcomeMessage","Hi User, welcome to the first    Spring MVC Application");

        return modelandview;
    }
}
这是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns="http://java.sun.com/xml/ns/javaee"     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SpringMVCTutorial</display-name>
        <servlet>
        <servlet-name>spring-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     </servlet>

     <servlet-mapping>
        <servlet-name>spring-dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
     </servlet-mapping>
  </web-app>
在dispatcher servlet的末尾没有


xsi:schemaLocation
中是否有正确的版本(2.5)

我只是看着我的,它看起来是这样的,也许这可以做到:

xsi:schemaLocation="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.xsd"

我想第三行应该和下面的一样

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
您有模式bean。应该是

模式/bean


。我想这就是问题所在。

我确实有标签。我只是没有把它抄进去。编辑:现在有问题了。该死,我希望是这样:)@libik,我想他有错误的名称空间声明。看看我的答案。是的,应该是:)。只是想知道它有帮助吗?不。我发现了问题。实例化bean处理程序映射类时出现拼写错误。org.springframework.web.servlet.handler.BeanNameUrlHandlerMaping maping而不是mappingWell,最初的错误应该是因为我在回答中指定了什么。在初始化上下文时,您指定的可能是其他错误。这是两个不同的错误。
xsi:schemaLocation="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.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">