Today, when I turned my project into MAVEN architecture, I came across a very wonderful problem, specifically as follows:
Org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line at XML document from class path resource [Spring-mvc.xml] is invalid; Nested exception is Org.xml.sax.saxparseexception:cos-all-limited.1.2:an "All" model group must appear in a particle w ith ' {' min occurs '} ' = ' {' Max occurs '} ' =1, and that particle must is part of a pair which constitutes the ' {' Content type '} ' of a complex type definition.
caused By:org.xml.sax.saxparseexception:cos-all-limited.1.2:an "All" model group must appear in a particle with ' {' Mi n occurs '} ' = ' {' Max occurs '} ' =1, and that particle must is part of a pair which constitutes the ' {' Content type '} ' of a COM Plex type definition.
Because of the previous Applicationcontext.xml encoding problem, then it is assumed that this document is also an encoding problem. Baidu for a long time, the end of the poor to put this XML file hand, still reported this error, really really got burned, coding problems, not very understand AH.
Then, think is not the JAR package import problem (direction, but I made a fatal error), so, the original project to re-import the jar package into the MAVEN generated war package, and then start, still this error, to be crazy.
In fact, the correct way should be to first remove the total jar package of the project, and then import the jar package from the original project, this is certainly not a problem. Because it is the import of a package that is controlled by Maven, it can only be the problem of packet conflict when importing, cause parsing error, re-check the process of the jar package introduction, it is found in this post that the jar package of XML document parsing was introduced in this blog, which caused the conflict.
The correct way to introduce DBCP dependencies is to:
Exclude Dependent Packages
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
</exclusions>
</dependency>
Everyone encourage Ah!!!
Line at XML document from class path resource [Spring-mvc.xml] is invalid; Nested exception is org.xml.sax.SAXParseException: