我在STS中配置Spring Data JPA时遇到了以下问题
Referenced file contains errors (jar:file:/.../war/WEB-INF/lib/spring-
context-3.0.RELEASE.jar!/org/springframework/context/config/spring-context-3.0.xsd).
- Referenced file contains errors (jar:file:/.../war/WEB-INF/lib/spring-
beans-3.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-beans-3.0.xsd).
- Referenced file contains errors (jar:file:/.../war/WEB-INF/lib/spring-
beans-3.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-tool-3.0.xsd)
我在applicationContext.xml文件的这个位置收到此错误。
<?xml version="1.0" encoding="UTF-8"?>
删除时错误消失
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
来自
<beans ...>
和
<jpa:repositories ... />
来自XML的标记。
答案 0 :(得分:0)
查看对话框
Window > Preferences > XML > XML CataLog
1.点击Window&gt;首选项并选择XML&gt; XML目录。
2.单击“添加”以创建新的商品。
Details:
Location: D:\...\spring-framework-3.0.5.RELEASE\projects\org.springframework.beans\src\main\resources\org\springframework\beans\factory\xml\spring-beans-3.0.xsd
Key type: Schema location
Key: http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
必须配置在xml文件的firist行中有错误的其他.xsd文件。
3.XML配置如下:
<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-3.0.xsd
...
..."
>
4.使用自动建议编辑<bean: ...>
和其他元素。