org.xml.sax.SAXParseException。。。找不到元素';上下文:组件扫描';
我有一个EclipseMavenSpring项目和一个org.xml.sax.SAXParseException。。。找不到元素';上下文:组件扫描';,xml,spring,soap,namespaces,Xml,Spring,Soap,Namespaces,我有一个EclipseMavenSpring项目和一个applicationcontext.xml。这是: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" x
applicationcontext.xml
。这是:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<description>SoapClient1</description>
<context:component-scan base-package="hu.bz.ikti.soap.test"/>
...
</beans>
后面的
xml元素开头有一个错误符号:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'http'. One of '{"http://
www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias,
"http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/
schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.
在xsi:schemaLocation
部分中,我试图添加
http://www.springframework.org/schema/context/spring-context-3.2.xsd,spring-context-3.1.xsd,spring-context.xsd
,但每次我都会遇到相同的错误
我的pom.xml文件中有以下内容:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.framework.version}</version>
</dependency>
org.springframework
spring上下文
${spring.framework.version}
有人能帮我吗?xsi:schemaLocation
不仅仅是一个模式列表,它是一个名称空间URI及其对应模式位置对的列表。所以你需要更像
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
您好,我添加了
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
但我仍然会遇到同样的错误。。。。我已经有了一个xmlns:context=”http://www.springframework.org/schema/context“
element.@SzZ您也安装了安全模块吗?schemaLocation属性应该是交替的名称空间和模式,问题中的示例是“beansNS beansSchema securitySchema”,即缺少securityNS。您肯定在使用所有spring库的3.1版吗?通过这些声明:
,添加安全性:
前缀,并将user&pw标记放在工厂bean中,问题就解决了。
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">