schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring- beans-4.1.5.xsd

The error is because it could not find the xsd. Try doing the below which is using a specific version 4.1.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd">

Or if you don't mention a version, it will try to use the latest.

<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE beans>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">

From Cosmina I. - Pivotal Certified Professional Spring Developer Exam A Study Guide - 2017

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd

A recommended (best) practice is to use this, since the version will be correctly identified from the Spring dependency version in the project. Also, the other advantage is that you can upgrade the Spring version you are using, and the new definition specifications will be automatically supported in your configuration files without your having to modify them


There is no such xsd in any Spring jar : http://www.springframework.org/schema/beans/spring-beans-4.1.5.xsd

Spring xsd for Spring 4.1.x can be referenced by : http://www.springframework.org/schema/beans/spring-beans-4.1.xsd or better : http://www.springframework.org/schema/beans/spring-beans.xsd

The correspondance between the URL and the real location inside each spring jar can be found in META-INF/spring.schemas, so the "version less" URL will still work when u upgrade Spring.

Tags:

Spring

Web.Xml