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 6130857
In Process

The Archive Base Latest Questions

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

All my junit tests have been passing in eclipse, but when run from the

  • 0

All my junit tests have been passing in eclipse, but when run from the console they seem to throw ClassNotFoundException for the AJ class RiskLogAspect.aj I can verify that in eclipse this is correctly weaving and providing the required functionality.

I’ve tried adding dependencies to my project to make sure there all correct.

I started adding the aspectj-maven-plugin

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                    <goal>test-compile</goal>
                </goals>
            <phase>process-sources</phase>
                <configuration>
                    <showWeaveInfo>true</showWeaveInfo>
                    <encoding>UTF8</encoding>
                    <source>1.6</source>
                    <target>1.6</target>
                    <aspects>
                        <includes>
                            <include>com.idna.riskprofile.RiskLogAspect</include>
                        </includes>
                    </aspects>
                </configuration>
            </execution>
        </executions>
    </plugin>

I then added the following dependencies

      <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.7</version>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>1.6.7</version>
    </dependency>

Any ideas what’s going wrong ?

I’m running maven 2.0.9 and also jdK 1.6 update 21

After changing some of my configuration I’ve noticed in the console I get the follow ” [Xlint:adviceDidNotMatch] ” It seems like it is picking up my class but not applying the pointcut correctly.

For the goal compile it finds the AJ file and applies the advice correctly, for the test-compile goal it says Xlint:adviceDidNotMatch and throws class not found exceptions for half the junit tests.
From the console:

[INFO] [aspectj:compile {execution: default}]
[INFO] Join point 'method-execution(java.lang.String com.idna.riskprofile.impl.RiskProfileEntryPointImpl.execute(com.idna.riskprofile.domain.RiskProfileRequest))' in Type 'com.idna.riskprofile.impl.RiskProfileEntryPointImpl' (RiskProfileEntryPointImpl.java:35) advised by around advice from 'com.idna.riskprofile.logging.aspects.RiskLogAspect' (RiskLogAspect.aj:35)
[INFO] [aspectj:test-compile {execution: default}]
[WARNING] advice defined in com.idna.riskprofile.logging.aspects.RiskLogAspect has not been applied [Xlint:adviceDidNotMatch]
[INFO] [resources:resources]

Updated: It seems that not weaving advice on the test-compile goal was not what was leading to the test failures on the console but another issue with spring configuration.

  • 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-23T16:54:26+00:00Added an answer on May 23, 2026 at 4:54 pm

    Registering the aspectj plugin isn’t enough, you need to register some goals as well:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.3.1</version>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                    <!-- use this goal to weave all your main classes -->
                    <goal>test-compile</goal>
                    <!-- use this goal to weave all your test classes -->
                </goals>
            </execution>
        </executions>
    </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From Eclipse I can easily run all the JUnit tests in my application. I
I have a JUnit run configuration to run all my unit tests. How can
Is there a way to run JUnit-Tests from several projects conveniently fast in Eclipse?
I have many JUnit tests, which are all created by Netbeans' assistant (so nothing
I have a strange issue with JUnit 4 tests in Eclipse 3.5 that I
I have Eclipse plug-in and junit tests for it, which are using jMock library.
in my Java Eclipse project that contains JUnit tests, I also have a package
Seems when I make move refactoring all my junit tests lays on its old
Almost all of my JUnit tests are written with the following signature: public void
I have an extremely odd problem in my JUnit tests that I just can't

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.