gst*_*low 2 java xml spring xsd spring-mvc
我的xml文件中的代码段:
<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"
xmlns:util="http://www.springframework.org/schema/util"
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/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<!-- http://www.springframework.org/schema/aop -->
<!-- http://www.springframework.org/schema/aop/spring-aop.xsd"> -->
<context:component-scan base-package="myPackage" />
Run Code Online (Sandbox Code Playgroud)
执行后我看到以下消息:
WARN [WrapperSimpleAppMain] [XmlBeanDefinitionReader]忽略XML验证警告org.xml.sax.SAXParseException; lineNumber:14; columnNumber:80; SchemaLocation:schemaLocation value =' http://www.springfr amework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.spri ngframework. org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springfra mework.org/schema/context/spring-context-3.1.xsd'必须有均匀URI的数量.at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
怎么解决这个问题吧?
Sot*_*lis 13
你的schemaLocation价值应该是形式
namespace-name schema-location [namespace-name schema-location]
Run Code Online (Sandbox Code Playgroud)
你错过了
http://www.springframework.org/schema/context
Run Code Online (Sandbox Code Playgroud)
之前
http://www.springframework.org/schema/context/spring-context-3.1.xsd
Run Code Online (Sandbox Code Playgroud)
因此应该是
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
Run Code Online (Sandbox Code Playgroud)
请注意,我已将util架构更改为3.1版.不要混搭.使用所有相同的版本.
| 归档时间: |
|
| 查看次数: |
9747 次 |
| 最近记录: |