开发者社区 问答 正文

spring 的一个小问题?报错

在搭建spring环境时,编写applicationContext.xml文件时,编写这个<tx:annotation-driven transaction-manager="transactionManager"/>时,发现报错

 Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx-2.5.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'.

前面的bean信息为:

 <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean> 
,头部信息为:

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

http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 

这是啥原因啊???



展开
收起
爱吃鱼的程序员 2020-06-22 13:32:36 475 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    没工夫代替电脑纠这个错,给你贴个起作用的

    复制粘贴即可

    <beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:task="http://www.springframework.org/schema/task"xmlns:jee="http://www.springframework.org/schema/jee"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.0.xsdhttp://www.springframework.org/schema/taskhttp://www.springframework.org/schema/task/spring-task-4.0.xsdhttp://www.springframework.org/schema/jeehttp://www.springframework.org/schema/jee/spring-jee-4.0.xsd"profile="test,product">



    谢谢啊!现在已经找到了,不是这个原因,而是在myeclipse中需要引入这个 spring-tx-2.5.xsd文件,并做适当的配置,就可以了所以说什么框架啊,XML这些东西都太落后了,非要全都配置好,少一个东西就启动不来,我们生活在一个技术多么落后的时代啊

    引用来自“二进制宇宙”的答案

    所以说什么框架啊,XML这些东西都太落后了,非要全都配置好,少一个东西就启动不来,我们生活在一个技术多么落后的时代啊

    引用来自“人称小明哥”的答案

    引用来自“二进制宇宙”的答案

    所以说什么框架啊,XML这些东西都太落后了,非要全都配置好,少一个东西就启动不来,我们生活在一个技术多么落后的时代啊
    你好像在我告诉我们:毛泽东当过主席。
    2020-06-23 11:58:58
    赞同 展开评论
问答分类:
问答标签:
问答地址: