gpt4 book ai didi

spring - Spring 应用程序上下文模式中的错误

转载 作者:IT老高 更新时间:2023-10-28 13:53:13 30 4
gpt4 key购买 nike

我在 Eclipse 中有一个 maven-spring 项目,并且在我的一个 spring 上下文中出现了这个烦人的错误消息:

Referenced file contains errors (jar:file:/M2_HOME/repository/org/springframework/spring-beans/3.1.2.RELEASE/spring-beans-3.1.2.RELEASE.jar!/org/springframework/beans/ factory/xml/spring-tool-3.1.xsd). For more information, right click on the message in the Problems View and select "Show Details..."

演出细节导致了这一点:

enter image description here

我使用 spring-data-jpa 1.2.0.RELEASE,其余的 spring jar 是 3.1.3.RELEASE。关于 spring-data-commons-core - 我什至在我的 pom 中都没有对这个 jar 的依赖,但我可以在我的 m2 存储库中看到它以及 spring-data-commons-parent 和版本 1.4.0.RELEASE ,我不知道为什么(也许那些是 spring-data-jpa 的一部分?)。

我的应用程序上下文架构:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd">

我不明白为什么我不断收到此错误。基本上它没有任何效果,应用程序编译、部署和运行都很好,只是 Eclipse 中这个恼人的红色错误标记让我发疯:)

最佳答案

我最近在最新的 Eclipse (Kepler) 中遇到了类似的问题,并通过禁用 Preferences > XML > XML Files > Validation 中的“Honour all XML schema locations”选项来修复它。它禁用对指向不同模式位置的相同命名空间的引用的验证,只采用通常在被验证的 XML 文件中找到的第一个。此选项来自 Xerces 库。

WTP 文件:http://www.eclipse.org/webtools/releases/3.1.0/newandnoteworthy/sourceediting.php

Xerces 文档:http://xerces.apache.org/xerces2-j/features.html#honour-all-schemaLocations

关于spring - Spring 应用程序上下文模式中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13693065/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com