Skip to main content

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


Terry,

Could you please post the whole message log, perhaps running with -verbose too. This message usually means that AspectJ can't find an aspect specified in aop.xml which means that it isn't on the classpath. The reason that you see org.aspectj.weaver.tools.Jdk14Trace is that when running under Java 5 AspectJ uses the java.util.logging (often refered to as JDK 1.4 logging) infrastructure for reporting errors.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM United Kingdom Limited
Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



Terry C Martin <tcmartin24@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

14/02/2007 01:59

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[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.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







Back to the top