我的applicationContext.xml文件有问题。

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xmlns:security="http://www.springframework.org/schema/security" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">

<import resource="classpath:spring/persistence.xml"/>

<context:annotation-config />
<context:component-scan base-package="com.sgcib.mrp.cva"/>

<util:properties id="jdbcProps" location="jdbc.properties" />

<bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
         <value>classpath:configuration.properties</value>
         <value>classpath:jdbc.properties</value>
        </list>
    </property>
</bean>

我收到此错误:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

这是什么意思 ?

最佳答案

这意味着架构文件不可用于应用程序。

您可以通过以下几种方法解决此问题:

  • 检查Internet连接和代理设置(由于某些连接问题,SAX解析器很可能无法获取它)
  • 只需下载模式文件,将其添加到您的类路径中,然后更改模式位置以指向您下载的文件即可。
  • 关于spring - SAXParseException,无法读取架构文档,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21777041/

    10-11 21:41