0

I am currently working on spring and I am very much new to this framework. I have added all the required jars of spring and written the following spring-dispatcher-servlet.xml file.

<?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>

My code works fine when there is internet connection but breaks down when I am not connected to the internet. And gives the following error.

Line 12 in XML document from ServletContext resource [/WEB-INF/spring->dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 109; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.

What am I doing wrong here?
Can any tell me the solution what needs to be done to work the project even offline?

catch23
  • 17,519
  • 42
  • 144
  • 217
Vipul
  • 49
  • 8
  • 3
    Possible duplicate of [Spring schemaLocation fails when there is no internet connection](http://stackoverflow.com/questions/1729307/spring-schemalocation-fails-when-there-is-no-internet-connection) – Vasu Apr 02 '17 at 09:07

1 Answers1

0

for xsi schema Location put

xsi:schemaLocation= "http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd http://www.springframework.org/schema/context classpath:org/springframework/beans/factory/xml/spring-context-3.0.xsd"

in your case code need to check on springframework.com every time

the schema location i provided should work because the xsd is packaged inside the spring jar here