Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/336.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.xml文件是否需要internet连接?_Java_Xml_Spring_Spring Mvc - Fatal编程技术网

Java spring.xml文件是否需要internet连接?

Java spring.xml文件是否需要internet连接?,java,xml,spring,spring-mvc,Java,Xml,Spring,Spring Mvc,我目前正在研究spring,我对这个框架非常陌生。我已经添加了spring所需的所有JAR,并编写了以下spring-dispatcher-servlet.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

我目前正在研究spring,我对这个框架非常陌生。我已经添加了spring所需的所有JAR,并编写了以下spring-dispatcher-servlet.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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-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/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.1.xsd">

    <context:component-scan base-package="com.quiz_mcq.controller, com.quiz_mcq.service, com.quiz_mcq.dao"/>  
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/" />
      <property name="suffix" value=".jsp" />
    </bean>

</beans>

我的代码在连接到internet时工作正常,但在未连接到internet时出现故障。并给出以下错误

ServletContext资源[/WEB-INF/spring->dispatcher servlet.XML]的XML文档中的第12行无效;嵌套异常为org.xml.sax.saxpasseeption;行号:12;栏目号:109;cvc复杂类型.2.4.c:匹配的通配符是严格的,但找不到元素“context:component scan”的声明

我做错了什么?

有没有人能告诉我解决方案,即使在脱机情况下,项目也需要做些什么

xsi:schemaLocation= " 类路径:org/springframework/beans/factory/xml/spring-beans-3.0.xsd 类路径:org/springframework/beans/factory/xml/spring-context-3.0.xsd”

在您的情况下,代码需要每次都在springframework.com上检查


我提供的模式位置应该可以工作,因为xsd打包在这里的spring jar中

可能与我在模式位置添加的代码重复,但它仍然给我相同的错误