欢迎光临散文网 会员登陆 & 注册

无法读取方案文档 'http://www.springframework.org/schema/cache/spring-mvc

2022-07-25 10:08 作者:温柔的烟火  | 我要投稿

org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 25; schema_reference.4: 无法读取方案文档 'http://www.springframework.org/schema/cache/spring-mvc.xsd', 原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是 <xsd:schema>



以上报错:


xsd文件无法读取,本地jar包文件获取失败


一般解决方法:


将https协议换为http

(我的改了也没办法)

然后从网上搜了好多方法,也了解了这个底层的逻辑

具体这里不细讲了

我的解决办法是:

打开自己读取不到方案文档的jar包,例如我的是spring-mvc

打开jar包找到spring.schemas
可以看到这里有几个版本号

你可以检查下自己的版本号

我这里复制一个

这个!

然后spring-mvc.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: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.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd">

<!--注解驱动-->
<mvc:annotation-driven/>
<!--    静态资源过滤-->
<mvc:default-servlet-handler/>
<!--    扫描包:controller-->
<context:component-scan base-package="com.monan.controller"/>
<!--    视图解析解-->
<!--    这里面有两个属性前缀后缀-->
   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
       <property name="prefix" value="/WEB-INF/jsp/"/>
       <property name="suffix" value=".jsp"/>
   </bean>
</beans>


然后这个不在报错

无法读取方案文档 'http://www.springframework.org/schema/cache/spring-mvc的评论 (共 条)

分享到微博请遵守国家法律