[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] "Cannot register non aspect" with @AspectJ jdk 1.5

First, I'm using Aspectj 1.5.3 with jdk 1.5 and I've created some aspects
using the jdk 1.5 annotation approach, i.e. my aspects are regular java
classes marked with @Aspect annotation.

I have a module representing a service/model layer of an application which
includes 3 aspects in it.  This module gets built into a jar file.  The
resulting jar file contains a META-INF directory with aop.xml specifying the
aspects in it.  This module contains tests in a separate src folder
(developing in eclipse & using Maven2 standards).  My tests run just fine
and I have no probs with aspects getting picked up and weaving working and
all that.

I have a web module for this app which depends on the services module jar
file.  The web app works just fine too, in Jetty and Tomcat with aspectj
weaving enabled via jdk 1.5's java agent mechanism.

Now, I've decided I want to pull some of my tests out of the service module
and put them into their own module because they're integration tests (as
opposed to unit) and this is a recommendation of the maven2 project.  So I
created another module, copied my tests into it and setup the services
module as a dependency for it.  When I try to run the tests, I get:

org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: register definition failed
java.lang.RuntimeException: Cannot register non aspect:

I initially thought it might have something to do with the fact that from my
int test module's perspective, when aspectj is told to find my aspects via
the aop.xml file it finds in the services jar file, it's expecting them to
be of the "aj" variety rather than @Aspect.  However, if that were the case,
it seems that it wouldn't work for my web apps either.  

Might the Jdk14Trace class have anything to do with it?  Does that class
come into play regardless of whether I'm running jdk 1.5 or 1.4?  Might it
only kick-in if aspectj thinks its running on jdk 1.4, thereby causing it to
ignore (or not even see) my jdk 1.5 @Aspect annotations?

I get this problem whether I run the tests from within eclipse or command
line via Maven2.

Again, tests run just fine from within the actual service module and the web
module, which includes the services jar, runs fine too.

Thanks,
Terry
-- 
View this message in context: http://www.nabble.com/%22Cannot-register-non-aspect%22-with-%40AspectJ-jdk-1.5-tf3224842.html#a8957550
Sent from the AspectJ - users mailing list archive at Nabble.com.