我正在尝试建立一个简单的spring应用程序,并且遇到了以下异常。

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from class path resource [NewFile.xml] is invalid; nested e
xception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.


我没发现问题。这是我的NewFile.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd" >


我使用Spring Integration 1.0.4,Spring core 2.5.6和javamail 1.4

最好的祝福

最佳答案

路径中有两个“模式”:

<beans xmlns="http://www.springframework.org/schema/schema/beans"


IIRC只需要一个:

<beans xmlns="http://www.springframework.org/schema/beans"

07-28 01:01
查看更多