org.aspectj.lang.NoAspectBoundException - method <init>()V not found

12,592

Solution 1

I found later, that I need aspectjrt dependency in my pom.

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>1.6.12</version>
</dependency>

edit: Missing dependency was an error, but real problem is Eclipse + aspects combination. When I used Eclipse to build my aspect class this error occurred. Additionally when I compiled class the aspect advice was for, aspect was not called.

solution: you have to use maven to build your application (I'd be glad if someone find solution for Eclipse, because I'm sure I'll forget this)

Solution 2

download http://central.maven.org/maven2/org/aspectj/aspectjrt/1.6.9/aspectjrt-1.6.9.jar and add to your project

Share:
12,592
Betlista
Author by

Betlista

If you want to learn something you have to investigate problems... If you use first workaround to achieve the goal, you learn less than if you fully understand the problem you are facing.

Updated on June 04, 2022

Comments

  • Betlista
    Betlista almost 2 years

    I had same problem as vanhre asked in Spring forum, but in my case I couldn't change the constructor.

    I'm using Spring java configuration, so it was initializing ok during jetty start, but in runtime, when I executed the functionality with my aspect it failed with exactly the same exception from the forum.

  • Betlista
    Betlista over 11 years
    I didn't understand what you wanted to say... I followed this link - blog.stackoverflow.com/2011/07/…
  • Rohit Jain
    Rohit Jain over 11 years
    @Betlista.. Oh. I thought you wanted to edit your post. Its ok to answer your own question of course.
  • kriegaex
    kriegaex about 9 years
    That library is many years old. The current version supporting Java 7 and 8 is 1.8.5. P.S.: And why are you answering an old question from 2012 with an already accepted answer anyway?
  • adramazany
    adramazany about 9 years
    I have same problem and found the solution but not maven way.
  • adramazany
    adramazany about 6 years
    I download aspectjrt-1.6.9.jar file directly and add it to my libraries, then problem solved.