Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Posts Tagged ‘XmlBeanDefinitionStoreException


leave a comment »


I was setting up a Spring powered web application for testing.
I edited the configurations files (*.xml) to add in some new configuration for testing / POC.
The following error is shown when I deployed the WAR file in tomcat
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 40 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'bean'. One of '{"":description, "":meta, "":constructor-arg, "":property, "":qualifier, "":lookup-method, "":replaced-method, WC[##other:""]}' is expected.

As highlighted above, there is error in the mentioned XML file.
After I opened the XML file, I found that is some missed-closed bean definition ABOVE the mentioned line (Line 40 in XML).
The error bean definition as below:

<bean id="accountManager" class="alfred.sandbox.AccountManager">

Added in a BLACK SLASH “/” to close the bean definition properly will solve the error:

<bean id="accountManager" class="alfred.sandbox.AccountManager"/>

Written by Alfred

September 15, 2011 at 17:40