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.

About these ads

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.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s




Follow

Get every new post delivered to your Inbox.

Join 114 other followers

%d bloggers like this: