Spring 2 XML validation errors (cvc-elt.1)

If you get one of these in Spring 2

org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.

Then you need to change your applicationContext.xml from


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
>

To


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
>

There may also be problems with local resolution of the xsd, but the Documentation on the web is wrong in a number of places.

Comments

One Response to “Spring 2 XML validation errors (cvc-elt.1)”

  1. matt dundas on September 11th, 2008 10:08 pm

    this fixed my Grails on WebLogic problem thanks

Leave a Reply




This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a