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:
<!--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://www.springframework.org/schema/beans/spring-beans-3.0.xsd ', reason 1) could not find document; 2) Unable to read the document; 3) The root element of the document is not <xsd:schema>.
caused By:java.net.SocketException:Software 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