Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring AOP The matching wildcard is strict, but no declaration can be found for element 'aop:config'

Tags:

spring

aop

Line 13 in XML document from class path resource [ApplicationContextAOP.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.

<?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/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="audience" class="com.idol.Audience" />

<aop:config>
<aop:aspect ref="audience">

    <!-- Before performance -->     

    <aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))"
    method="takeSeats"/>

    <aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))"
    method="turnOffCellPhones" />

    <!-- After performance -->  

    <aop:after-returning pointcut="execution(*com.idol.performers.Performer.perform(..))"
    method="applaud" />

    <!-- After bad performance(exception thrown) -->    

    <aop:after-throwing pointcut="execution(*com.idol.performers.Performer.perform(..))"
    method="demandRefund" />

</aop:aspect>
</aop:config>
<bean id="poeticDuke" class="com.idol.performers.PoeticJuggler">
<constructor-arg value = "15" />
<constructor-arg ref = "sonnet29" />
</bean>

</beans>

I've seen similar error and I am pretty sure my classpath has org.springframework.aop-3.1.0.M2.jar

Could you tell me please what am I missing?

like image 816
Aubergine Avatar asked Aug 19 '11 22:08

Aubergine


1 Answers

You need to add to your schemaLocation:

xsi:schemaLocation="
...
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
...
"
like image 91
Ryan Stewart Avatar answered Oct 21 '22 07:10

Ryan Stewart