org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException
ERROT:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException
STORY:
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 '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":meta, "http://www.springframework.org/schema/beans":constructor-arg, "http://www.springframework.org/schema/beans":property, "http://www.springframework.org/schema/beans":qualifier, "http://www.springframework.org/schema/beans":lookup-method, "http://www.springframework.org/schema/beans":replaced-method, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
SOLUTION:
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"/>
Leave a Reply