繁体   English   中英

验证文件spring-ldap.xsd时出错

[英]Error validating the file spring-ldap.xsd

我在我的bean配置中有这个错误,但是对于另一个项目工作.. xml是:

<?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:context="http://www.springframework.org/schema/context"
    xmlns:ldap="http://www.springframework.org/schema/ldap"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">

但是在一个项目中我有这个错误:

referenced file contains error http://www.springframework.org/schema/ldap/spring-ldap.xsd

更新:

我像这样修改我的光束并且工作(我添加conf。用于汇集但不重要):

<!-- LDAP config -->

    <bean id="contextSourceTarget" class="org.springframework.ldap.core.support.LdapContextSource">
        <property name="url" value="${ldap.url}" />
        <property name="base" value="${ldap.base}" />
        <property name="userDn" value="${ldap.userDn}" />
        <property name="password" value="${ldap.password}" />
        <property name="pooled" value="false" />
    </bean>

    <bean id="contextSource"
        class="org.springframework.ldap.pool.factory.PoolingContextSource">
        <property name="contextSource" ref="contextSourceTarget" />
    </bean>

    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
        <constructor-arg ref="contextSource" />
    </bean>

我想这是因为Pivotal的网站在显示实际XSD之前显示验证码,

当没有互联网连接时,请参阅Spring schemaLocation失败 Pivotal站点需要验证码

这取决于您是在IDE中还是在运行时中获得错误。

如果它是一个专门的XML编辑器,你应该参考编辑器的文档,了解如何覆盖/指定模式位置,如果它在运行时可能你必须检查你的项目依赖项(pom.xml,如果它是一个maven项目)。

Spring使用自己的机制在类路径库(运行时)中获取XSD。

使用以下文件

  1. META-INF/spring.handlers (用于通过处理程序将标记xml解析为对象)

spring-core-3.2.2.jar的例子

http://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler

  1. META-INF/spring.schemas (用于标识所使用的正确xsd)

spring-core-3.2.2.jar的例子

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd http://www.springframework.org/schema /beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd= org / springframework / beans / factory / xml / spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring -beans-3.1.xsd http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd http:// www .springframework.org / schema / beans / spring-beans.xsd = org / springframework / beans / factory / xml / spring-beans-3.2.xsd http://www.springframework.org/schema/tool/spring-tool- 2.0.xsd = org / springframework / beans / factory / xml / spring-tool-2.0.xsd http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory /xml/spring-tool-2.5.xsd http://www.springf ramework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd http://www.springframework.org/schema/tool/spring-tool -3.1.xsd = org / springframework / beans / factory / xml / spring-tool-3.1.xsd http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/ factory / xml / spring-tool-3.2.xsd http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd http: //www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd http://www.springframework.org/schema/util /spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/ springframework / beans / factory / xml / spring-util-3.0.xsd http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util -3.1.xsd http://www.springframework.org/schema/util/spring-util -3.2.xsd = org / springframework / beans / factory / xml / spring-util-3.2.xsd http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/ XML /弹簧util的-3.2.xsd

IDE希望通过schemaLocation解析XSD的位置,因此我建议删除Eclipse上的XSD验证。

Windows-> Preferences-> Validation->“暂停所有验证器”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM