Line at XML document from class path resource [Spring-mvc.xml] is invalid; Nested exception is org.xml.sax.SAXParseException:

Source: Internet
Author: User
Tags cos

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:

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.