Question

What would cause this problem at run-time?:

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

Here is the relevant Spring XML:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/util
       http://www.springframework.org/schema/util/spring-util-2.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
    .
    .
    .
    <aop:config>
        <aop:advisor pointcut="execution(* acme.exam.driver.ui.components..*(..))" 
                     advice-ref="loggingInterceptor" />
    </aop:config>

    <bean id="loggingInterceptor" 
          class="org.springframework.aop.interceptor.CustomizableTraceInterceptor">
        <property name="enterMessage" 
                  value="ENTER: $[targetClassShortName].$[methodName]($[arguments])" />
        <property name="exitMessage" 
                  value="EXIT: $[targetClassShortName].$[methodName]($[arguments]) = $[returnValue])" />
    </bean>
</beans>

Note that I’ve already put aspectjweaver.jar and aspectjrt.jar on the class path.

Was it helpful?

Solution

Did you doublecheck the spring aop artifact on classpath ?

And according to my maven dependencies, aspectjweaver is not enough, i needed also aspectjrt.

OTHER TIPS

Make sure that <spring-framework-directory>/dist/modules/spring-aop.jar is in your class path.

For anyone else, I resolved this error in my configuration, where the namespace included the item

xmlns:aop="http://www.springframework.org/schema/aop

though had not included the xsi:schemaLocation elements

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

This configuration error caused the message above.
Adding in the schemaLocation elements resolved it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top