SSH Applicationcontext.xml Import exception

Source: Internet
Author: User

Recently, on the project, encountered a problem, when the configuration Applicationcontext.xml use <import> tags to introduce other XML files, causing the project to start too slow, and sometimes cause a startup exception, and later found to be the XML file header in the setup problem, Although not very aware of the role of the label head, but also to share with you the experience:

Applicationcontext.xml file, only part of the code is posted:

<!--file Headers--
Xmlns= "Http://"
Xmlns:xsi= "Http://"
xmlns:p= ""
Xsi:schemalocation= "Http://

Http:// ">

<!--injected into the Basedao layer for other Spring.xml file inheritance--
<bean id= "Basedao" class= "Framework.base.BaseDao" >
<property name= "sqlmapclient" ref= "Sqlmapclient"/>

<import resource= "Com/shipment/dao/shipmentspring.xml"/>

The Shipmentspring.xml file introduced:

As you can see, the second file Shipmentspring.xml in the file header, xsi:schemalocation two more lines out

The following is the information about the console at startup, with some exception information posted:

Org.xml.sax.SAXParseException; Linenumber:9; columnnumber:78; SCHEMA_REFERENCE.4: Unable to read schema document ' Http:// ', reason 1) could not find document; 2) Unable to read the document; 3) The root element of the document is not <xsd:schema>.

caused caused connection Abort:recv failed

May 12, 2014 9:55:49 am org.apache.catalina.core.StandardContext listenerstart
Severe:exception Sending context Initialized event to listener instance of class Org.springframework.web.context.ContextLoaderListener
Org.springframework.beans.factory.parsing.BeanDefinitionParsingException:Configuration problem:failed to import Bean definitions from relative location [Com/shipment/dao/shipmentspring.xml]
Offending resource:class path resource [Applicationcontext.xml]; Nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: line 9 in XML document from class path resource [Com/shipment/dao/shipmentspring.xml ] is invalid; Nested exception is org.xml.sax.SAXParseException; linenumber:9 ; columnnumber:78; Cvc-elt.1: The declaration of element ' beans ' could not be found.

Caused by:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: line9 in XML document from Class path resource [Com/shipment/dao/shipmentspring.xml] is invalid; Nested exception is org.xml.sax.SAXParseException; Linenumber:9; columnnumber:78; Cvc-elt.1: The declaration of element ' beans ' could not be found.

caused by:org.xml.sax.SAXParseException; Linenumber:9; columnnumber:78; Cvc-elt.1: The declaration of element ' beans ' could not be found.

When starting, the control often stays in the following two lines:

You can see the font I marked in red, all in line 9th, and then look at line 9th of the Shipmentspring.xml file. At first I noticed here, and later I copied the applicationcontext.xml file header into the Shipmentspring.xml, the Shipmentspring.xml original file header deleted, the project will start normally, and start much faster

May 12, 2014 10:08:22 am Org.apache.catalina.startup.Catalina start
Info:server Startup in 7933 MS

The original boot speed (this is the original configuration of the normal start speed, the exception when the start time to complete more than 30 seconds):

May 12, 2014 9:55:50 am Org.apache.catalina.startup.Catalina start
Info:server Startup in 21174 MS

Note: These two files of the file header I was in other people's projects to copy over, others there can normally start, and start the completion time is also within 10 seconds.

The role of the file header (do not know right, everyone to check): I think it seems to be in the specified path to find the corresponding file, but also play a role in restricting the correct label writing

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.