views:

661

answers:

2
+1  Q: 

Spring AOP error

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"&gt;
    .
    .
    .
    <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.

+1  A: 

Did you doublecheck the spring aop artifact on classpath ?

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

Michael Lange
What is the "spring aop artifact"?
Paul Reiners
seems that you found the artifact name :-)
Michael Lange
A: 

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

Paul Reiners