我已经在这个问题上困了一段时间了。我一直在开发一个gwt + spring backend java项目。我的项目是由一个GWT项目和另一个用于spring服务的java项目构成的,等等。每个项目都包含各自的spring-config文件。当我尝试加载弹簧配置时,如果我使用tx:annotation-driven
我不断地得到以下信息。org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx-3.0.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:annotation-driven'.
值得一提的是,我正在使用eclipse的google插件在sts内的gwt容器中进行部署。
我的spring-servlet命名空间的开头是这样的
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="h ttp://www.w3.org/2001/XMLSchema-instance" xmlns:aop="h ttp://www.springframework.org/schema/aop" xmlns:context="h ttp://www.springframework.org/schema/context" xmlns:p="h ttp://www.springframework.org/schema/p" xmlns:util="h ttp://www.springframework.org/schema/util" xmlns:tx="h ttp://www.springframework.org/schema/tx" xsi:schemaLocation="h ttp://www.springframework.org/schema/aop h ttp://www.springframework.org/schema/aop/spring-aop-3.0.xsd h ttp://www.springframework.org/schema/beans h ttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd h ttp://www.springframework.org/schema/util h ttp://www.springframework.org/schema/util/spring-util-3.0.xsd h ttp://www.springframework.org/schema/tx h ttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd h ttp://www.springframework.org/schema/context h ttp://www.springframework.org/schema/context/spring-context-3.0.xsd"> <tx:annotation-driven transaction-manager="transactionManager"/>
我已经写了很多帖子来理解它,但还是没能解决这个问题。a)尝试使用以下命令将模式导入到xml-catalog中:jar:file:path/to/spring-framework-3.0.5.RELEASE/dist/org.springframework.transaction-3.0.5.RELEASE.jar!/org/springframework/transaction/config/spring-tx-3.0.xsd,key作为http://www.springframework.org/schema/context/spring-context-3.0.xsd,type作为模式位置。
感谢您的帮助或指点!
发布于 2011-06-22 12:47:45
适用于在包含STS和maven的环境中遇到类似问题的其他人。确保将正确的jar添加到您的pom.xml中,然后使用-clean选项更新ur依赖项、刷新工作区、关闭项目并重新打开或重新启动STS。上面的其中一个会让它为你工作。HTH
https://stackoverflow.com/questions/5996339
复制相似问题