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

28 04 2007

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.


Actions

Information

3 responses

11 09 2008
matt dundas

this fixed my Grails on WebLogic problem thanks

3 09 2009
TU

Thanks for your information, but could you please more detail ?

3 09 2009
Ian

The location of the XSD is incorrect after a version upgrade. I think it was 2.0.x to 2.2.x, hence, to parse and validate the XML, the correct location of the XSD is required.




%d bloggers like this: