Announcement Announcement Module
No announcement yet.
No matching factory method found: factory method 'aspectOf' Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

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


    this is my first try of using tc-server and I encountered a "little" problem in the AOP area. We use compile time weaving to introduce aspects which works fine when building with maven and deploying the WAR to a "normal" tomcat. When the same WAR is dropped to the webapp folder of tc-server I get "No matching factory method found: factory method 'aspectOf'". Seems that the LTW conflicts with CTW classes. We can't use the proxy approach because this omits all aspects on methods in case a method calls a second method on the same instance.

    Can anyone can give me a hint how to solve this conflict or in which direction to dig?

    Thanks in advance


  • #2
    Most likely your problem relates to reweaving. Try the following:
    1. Include your CTWed aspects in the war (you are probably already doing this, but just to make sure).
    2. Include an aop.xml listing the CTWed aspect (you can do it easily by passing -outxml to the AspectJ compiler). Make sure that the aop.xml is under META-INF directory in a classpath component.



    • #3
      Ramnivas' makes some great suggestions there, but (as the AspectJ developer) I'd like to know a couple more details - as I think you should have seen an error earlier than "No matching factory method found: factory method 'aspectOf'" which should have been more helpful.

      Did you get no exceptions earlier in your log relating to reweaving?
      Are your compile time aspects annotation style (pure java but annotated with @Aspect, @Pointcut) or code style?

      Andy Clement
      AspectJ Development


      • #4

        Hi Ramnivas, hi Andy

        many thanks to both of you for your quick reply.
        I first checked Ramnivas hints and this worked right out of the box. All I did was to modify my MVN pom:


        so the interesting part is <outxmlfile>.
        I rebuild the WAR and dropped it to tc-server and the error magically disappeard including correctly calling the aspect code.

        I only used @Aspect and @AfterReturning annotations in my class no exception occured earlier in any of the logs (beside I might be blind :-)

        Again thanks to both of you.