解决spring事务启动错误can be found for element 'tx:advice'.

本文详细探讨了在Eclipse环境下,使用JDK1.8和Spring4.3.6进行事务管理时遇到的配置错误。作者最初在XML配置文件中添加了Spring的事务管理命名空间和对应的xsd文件路径,但在使用tx:advice标签时遇到了问题。通过对比两种不同的命名空间配置方式,最终发现移除版本号可以避免错误,但具体原因仍待探讨。

spring事务启动报错(eclipse,jdk1.8,spring4.3.6

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 
     'tx:advice'.

 

一开始我的命名空间是下方蓝色字体的,没有加tx之前是没有发现任何问题,直到我使用tx便签时报了上面红字错误

为此我百度了很久,大佬都说是schemaLocation里面没有添加

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

但很明显我是有添加的,而后我改用了紫色字体的命名空间,也就是把所有版本号都去除了,就不报错了

虽然解决了,但是不知道是什么原因,有大佬知道的话谢谢留言

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
    xmlns:aop="http://www.springframework.org/shcema/aop"
    xmlns:tx="http://www.springframework.org/shcema/tx"
    xmlns:context="http://www.springframework.org/shcema/context"    
    xsi:schemaLocation="http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
   http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd
 http://www.springframework.org/shcema/context
 http://www.springframework.org/shcema/context/spring-context-4.3.xsd
 http://www.springframework.org/shcema/aop
 http://www.springframework.org/shcema/aop/spring-aop-4.3.xsd"
 >

 

 

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       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/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值