Status 500

来源:互联网 发布:紫砂壶开壶 知乎 编辑:程序博客网 时间:2024/04/28 21:10

在学spring mvc时加入

  <mvc:annotation-driven/><!-- 使用默认的Servlet来响应静态文件 -->  <mvc:default-servlet-handler/>

后报Status 500 - Servlet.init() for servlet springMVC threw exception错误,而且

<mvc:default-servlet-handler/>

会标红报错,
经过研究后我发现原因是:一开始spring的配置文件是idea帮忙创建,没有配好xsd文件
正确配好后为:

<?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:mvc="http://www.springframework.org/schema/mvc"    xmlns:context="http://www.springframework.org/schema/context"    xsi:schemaLocation="        http://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd        http://www.springframework.org/schema/mvc        http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd             http://www.springframework.org/schema/context        http://www.springframework.org/schema/context/spring-context-4.2.xsd">         </beans>
上面的4.2是我的spring版本,我用的是4.2.0版本。

然后错误就解决了。

一般来说,出现这个错误是因为你的配置文件出现错误,要仔细检查配置文件还有没有其他错误。

原创粉丝点击