Home > other >  The matching wildcard is strict, but no declaration can be found for element 'aop:aspectj-autop
The matching wildcard is strict, but no declaration can be found for element 'aop:aspectj-autop

Time:07-11

I am facing the below issue in my spring config xml file-

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:aspectj-autoproxy'. My xml file-

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

I have added all these aop related jars

spring-aop-4.1.4.RELEASE.jar
aopalliance-1.0.jar
aspectjrt-1.7.4.jar
aspectjtools-1.7.4.jar
aspectjweaver-1.9.9.1.jar
cglib-3.3.0.jar
asm-7.1.jar

through maven dependency, but still facing the issue. Any pointer would be helpful.

CodePudding user response:

There is a typo in the xsi:schemaLocation

It should be http://www.springframework.org/schema/aop instead of http://www.springframework.org/schema/aop/. ( note the / at the end )

corrected entries

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