Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6379261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:06:54+00:00 2026-05-25T02:06:54+00:00

We used aspectJ to get some metric on an existing application. When building and

  • 0

We used aspectJ to get some metric on an existing application. When building and weaving with AJDT in eclipse, everything works great. But in the integration env. we use an ant script to build and deploy the application.

The problem occur on an ExceptionHandler i did to be sure our aspect would not throw exception and break the application

@Aspect
public class ExceptionHandlerAspect {

    /**
     * Pointcut
     */
    @Pointcut("within(com.xxx.yyy.aop.aspect.*..*)")
    public void allMethodInAspectPackage() {}

    /**
     *  Pointcut
     */
    @Pointcut("!within(com.xxx.yyy.aop.aspect.ExceptionHandlerAspect)")
    public void notInExceptionHandlerAspectClass() {}
    /**
     *  Pointcut
     */
    @Pointcut("call(* *(..))")
    public void allClassAndMethod() {}

    /**
    @Around("allClassAndMethod() && allMethodInAspectPackage() && notInExceptionHandlerAspectClass()")
    public Object logException(ProceedingJoinPoint joinPoint) throws Throwable{
        Object ret = null;
        try {
            ret = joinPoint.proceed();
        }catch (Throwable exception) {
            if (joinPoint.getSignature().getDeclaringTypeName().equalsIgnoreCase("org.aspectj.lang.ProceedingJoinPoint")) {
                throw exception;
            }
            this.logException.info("Exception in " + joinPoint.getSignature().getDeclaringTypeName(),exception);
        }finally {
            return ret; 
        }

    }

}

Basicaly, i want to intercept every call within my aspects package except in the ExceptionHandler itself.

the ant build look like this :

<iajc inpath="${classes.dir}" destDir="${classes.dir}" fork="true" maxmem="${aspectj.maxmem}" verbose="true" showWeaveInfo="true" debug="true">
    <classpath refid="ajclasspath"/>
</iajc>

The ${classes.dir} is the classes directory where the javac task built the application and the aspects

From the result,

Exception in thread "main" java.lang.NoSuchMethodError: com.xxx.yyy.aop.aspect.ExceptionHandlerAspect.aspectOf()Lcom/xxx/yyy/aop/aspect/ExceptionHandlerAspect;
    at com.xxx.yyy.aop.aspect.ecs.AspectBaseEcs.inspectLoginInfo(AspectBaseEcs.java:65)
    at com.xxx.yyy.app.es.security.Security.loadApplications(Security.java:172)
    at com.xxx.yyy.app.es.gui.VSDlgLogin.loadSecurity(VSDlgLogin.java:346)
    at com.xx.yyy.app.es.ApplicationSuite.start(ApplicationSuite.java:839)
    at com.xxx.yyy.app.es.ApplicationSuite.main(ApplicationSuite.java:501)

it looks like the ExceptionHandler was not weaved!!!

I hope someone can help me on this one 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:06:55+00:00Added an answer on May 25, 2026 at 2:06 am

    Finally found the problem. Our Application had a dependency on common module jar that was containing aspect too.

    The base package name was the same: com.xxx.aop and the base class we used for our aspects was the same name. So 2 com.xxx.aop.AspectBase.class were loaded.

    Since we used a flag in our Ant build file to enable compile time weaving at yes/no, one of our AspectBase.class was not weaved while the other was.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used mmap(just try to understand how mmap works) to allocate 96k anonymous memory,
I used HTTPService for reading xml, but I want only a particular xml field
I had an SVN background before and I get used to working between branches
My application contains 3rd party jar (com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar) that is compiled in Java6. I managed
I am using Spring's declarative transactions (the @Transactional annotation) in aspectj mode. It works
I'm struggling with some JavaScript code that I have used countless times across my
Used to be quite happy with the Ctrl + Shift + F10 shortcut in
Used code I found on SO to use the COM based Acrobat Reader to
I used a tool a few months ago that scanned a specified website and
There used to be an option in the submit wizard where you can specify

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.