Spring Start exception: Cvc-elt.1:cannot find the declaration of element ' Beans ' (RPM)

Source: Internet
Author: User

Spring Start exception: Cvc-elt.1:cannot find the declaration of element ' beans ' 2008-09-07 22:41
changed the online chat room code today to launch the application test. The result throws a whole bunch of exceptions:-------------------------------------------------------------------------- ------------------ org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:Line 4 in XML document From class path resource [Applicationcontext.xml] is invalid; Nested exception is org.xml.sax.saxparseexception:cvc-elt.1:cannot find the declaration of element ' beans '.
that's weird. It's all good in the morning. Suddenly it says the spring configuration file is not correct. According to the exception: ' Beans ' is not defined. This could be a problem with the namespace:------------------------------------------- ---------------------------------------------------------------------- <?xml version= "1.0" encoding= "UTF-8 "?> <beans xmlns=" Http://www.springframework.org/schema/beans "xmlns:xsi=" http://www.w3.org/2001/ Xmlschema-instance "xsi:schemalocation=" Http://www.springframework.org/schema/beans/http Www.springframework.org/schema/beans/spring-beans-2.5.xsd ">
This definition is automatically generated by myeclipse. There should be no mistake. There is no way, only on Baidu. A few netizens also have my similar problem. One of the users answer is very classic: Spring website has a problem, the namespace file can not be found, of course, problems. His solution is: Wait until the spring official website is ready and try again.
I also think this is very reasonable, but also in the QQ group to several partners to send a message that because the Srping official website has a problem, chat room can not be debugged.
But the more I think about it, the more uneasy it is. Wouldn't it be all the applications that use spring rely on the spring website?
This is too dangerous, in case of which Tianguan net completely problems (of course, this may be very small), then all the programs are not finished?
Besides, the namespace file can be downloaded and placed locally, why must it be networked? What if there was no internet connection, wouldn't it be possible to start the app?
in the Baidu search for a long time, did not find a solution. Up and down Google, also good, found, a netizen solved this problem, seemingly very simple:----------------------------------------------------- ---------------------------------------------------------------- <?xml version= "1.0" encoding= "Utf-8"?> <! DOCTYPE beans Public "-//spring//dtd BEAN 2.0//en" "Http://www.springframework.org/dtd/spring-beans-2.0.dtd" > < Beans>
Why is this, the Netizen said is the version problem, I also do not know the specific reason, anyway good is good.

The above anomalies are common, there are two main aspects:

First, the AOP path is not included:

<beans xmlns= "Http://www.springframework.org/schema/beans" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "xmlns:aop=" HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP "xsi:schemalocation="/HTTP/ Www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd/HTTP WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-3.0.xsd//Here according to the version is not the same,  The numbers are not the same. ">

Second, LIB files may be missing:

See if your lib has import: Com.springsource.org.aspectj.weaver-1.6.8.release.jar

If the above two points are confirmed, then OK. ‘

---------------------------------------------------------------------

When you start spring, the following error is reported,

The reason is that the version of the XSD in XML is not configured inconsistently, I'm using spring-2.5.6, but the configuration file has a 3.0. You can change it as follows:

In addition, when configuring, pay attention to the encoding of the configuration file, otherwise, when compiling, the output encoding and your configuration file encoding inconsistent, will produce garbled files.

Spring Start exception: Cvc-elt.1:cannot find the declaration of element ' Beans ' (RPM)

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.