How to resolve: Spring XSD schema error – schema_reference.4: Failed to read schema document

Problem Statement

While loading a Spring Context XML file i get the following error:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document …because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not

This error is caused by the fact that the XSD being referred is not found (either because it does not exist OR there is no internet connection).

1. Download the XSD and place it in your Classpath.
2. In the xsi:schemaLocation=”…” section of your Spring Context file, change the path to XSD from http to classpath.

<beans schemalocation=";

After Change:
<beans schemalocation="

Thats it.


4 responses

  1. This post saved me a whole bunch of time. Thanks v much!

  2. Hey, classpath: is giving the following error unknown protocol: classpath

    I have the same problem with respect to persistence.xml. It was all working and I am not sure I have changed something with respect to version now I reverted back but still its throwing the same error.

    I am unable to give the classpath like you have mentioned. Can you help me?

  3. Hi

    It is the version conflict of spring-xxx.jar, the XSD you used is not match with the jar in your class path, for this I change XXD version as the version of jar like


    as I have the jar in my classpath spring-2.5.5.jar

    Thank You

  4. Thanks Bibhuti ..possibly version conflict can cause this also.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: