Results 1 to 2 of 2

Thread: No matching factory method found: factory method 'aspectOf'

  1. #1

    Default No matching factory method found: factory method 'aspectOf'

    Hi,


    I'm trying to setup a spring managed @AspectJ style aspect. Just to be clear I'm using AspectJ, not SpringAOP, with the Tomcat LTW.

    Upon application statup I get the following error, when Spring tres to initialize my aspect.

    Code:
    No matching factory method found: factory method 'aspectOf'
    This would imply that the aspectOf method needs to be implement on my aspect. Yet, I haven't seen any mention of this requirment in the docs. If I were using CTW the compile time weaver would have added this method for me. Does the LTW not provide this method?

    I've included my Aspect, aop.xml, and portions of my application context.xml below. Anythoughts would be helpful

    My Aspect:
    Code:
    @Aspect
    public class SetUserCredentialsAspect extends JdbcDaoSupport{
    
        @Pointcut("initialization(webservices.service.admin.*.new(..))")
        private void adminServices(){}
    
        //@Pointcut("")
        //private void userValidatorInterceptor(){}
    
        @Before("adminServices")
        private void  setAdminServices()
        {
            logger.warn("^^^^^^^^^^^^^^^^^^^HERE^^^^^^^^^^^^^^^^^^^^^");
        }
        public static SetUserCredentialsAspect aspectOf(){
            return Aspects.aspectOf(SetUserCredentialsAspect.class);
        }
    }
    My Aop.xml
    Code:
    <aspectj>
        <weaver options="-showWeaveInfo -verbose">
            <include within="webservices"/>
         </weaver>
        <aspects>
            <aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect" />
            <aspect name="gov.gov.ic.dia.wiseism.webservices.aspects.SetUserCredentialsAspect" />
        </aspects>
    </aspectj
    ApplicationContext.xml
    Code:
       <!-- Turn on the LTW -->
        <context:load-time-weaver aspectj-weaving="on" />
    
        <tx:annotation-driven transaction-manager="transactionManager" order="1000" mode="aspectj" />
    
        <!-- Turn on Aspect J -->
        <!--<aop:aspectj-autoproxy/>-->
    
    
        <bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect" factory-method="aspectOf" dependency-check="none">
            <property name="transactionManager" ref="transactionManager"/>
        </bean>
    
        <bean id="setUserCredentialsAspect" class="webservices.aspects.SetUserCredentialsAspect" factory-method="aspectOf"  dependency-check="none">
            <property name="jdbcTemplate" ref="jdbcTemplate"/>
        </bean>

  2. #2
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    The setup looks right to me (except you don't need AnnotationTransactionAspect bean, since tx:annoation-driven will cover that). I suspect that load-time weaver setup isn't right. Do you see any output from the weaver (since you have specified -showWeaveInfo and -verbose)?

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •