I get an error in spring-dispatcher.xml in eclipse as given below.
schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring- beans-4.1.5.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>.
I have latest spring libraries...
spring-beans-4.1.5.RELEASE.jar spring-beans-4.1.5.RELEASE-javadoc.jar spring-beans-4.1.5.RELEASE-sources.jar spring-context-4.1.5.RELEASE.jar spring-context-4.1.5.RELEASE-javadoc.jar spring-context-4.1.5.RELEASE-sources.jar spring-context-support-4.1.5.RELEASE.jar spring-context-support-4.1.5.RELEASE-javadoc.jar spring-context-support-4.1.5.RELEASE-sources.jar spring-webmvc-4.1.5.RELEASE.jar spring-webmvc-4.1.5.RELEASE-javadoc.jar spring-webmvc-4.1.5.RELEASE-sources.jar spring-webmvc-portlet-4.1.5.RELEASE.jar spring-webmvc-portlet-4.1.5.RELEASE-javadoc.jar spring-webmvc-portlet-4.1.5.RELEASE-sources.jar
spring-dispatcher.xml as given below...
<?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.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
It would be great if I get some help... The posts with same subject did not help me to resolve this.Thanks in advance...
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With