SpringSource Tool Suite找不到Spring架构文件

时间:2013-06-21 15:02:10

标签: eclipse spring sts-springsourcetoolsuite

我不知道这是STS / Eclipse或我的项目设置的问题,但STS抱怨我的Spring模式。

Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jee:jndi-lookup'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/jee/spring-jee.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root 
 element of the document is not <xsd:schema>.

Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root 
 element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:advice'.

Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/aop/spring-aop.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root 
 element of the document is not <xsd:schema>.

这是我的应用程序配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

    <jee:jndi-lookup expected-type="java.lang.String" id="myId" jndi-name="myJndiName"/>

    <!-- Other stuff with no problems ommitted -->

    <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <!-- all methods starting with 'get' are read-only -->
            <tx:method name="get*" read-only="true"/>
            <!-- other methods use the default transaction settings (see below) -->
            <tx:method name="*"/>
        </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut expression="execution(* com.example.service.*.*(..) )" id="servicesPointcut"/>
        <aop:advisor advice-ref="transactionAdvice" pointcut-ref="servicesPointcut"/>
    </aop:config>

</beans>

以下是我的类路径中的Spring JAR:

spring-aop-3.1.4.RELEASE.jar
spring-asm-3.1.4.RELEASE.jar
spring-batch-core-2.1.9.RELEASE.jar
spring-batch-infrastructure-2.1.9.RELEASE.jar
spring-batch-test-2.1.9.RELEASE.jar
spring-beans-3.1.4.RELEASE.jar
spring-context-3.1.4.RELEASE.jar
spring-context-support-3.1.4.RELEASE.jar
spring-core-3.1.4.RELEASE.jar
spring-data-commons-1.5.1.RELEASE.jar
spring-data-jpa-1.3.1.RELEASE.jar
spring-expression-3.1.4.RELEASE.jar
spring-jdbc-3.1.4.RELEASE.jar
spring-orm-3.1.4.RELEASE.jar
spring-oxm-3.1.4.RELEASE.jar
spring-test-3.1.4.RELEASE.jar
spring-tx-3.1.4.RELEASE.jar

查看我的项目类路径,我可以找到包含行spring-context-3.1.4.RELEASE.jar/META-INF/spring.schemas的{​​{1}}。类似的文件位于我的类路径的http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd中,用于AOP标记。

有人对如何摆脱这个错误提出任何建议吗?

1 个答案:

答案 0 :(得分:0)

您已在classpath中添加了spring-tx-3.1.4.RELEASE.jar,并在spring.xm中添加了http://www.springframework.org/schema/tx/spring-tx.xsd。也许您使用的xsd声明是旧的? (即使用:http://www.springframework.org/schema/tx/spring-tx-3.1.xsd