[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] LTW and build-time weaving used together result in an unexpected org.aspectj.bridge.AbortException
|
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=104218 for a discussion of the
"reweavableAspectNotRegistered" message. Off-hand, it does seem like you'd want
to be able to do as you say: weave binaries at load-time with one set of aspects,
even if the binaries have been woven at build-time with another set.
(Hmm - would you want the build-time aspects to be woven as they are loaded?)
<beniceif>
I've long thought it would be useful to have a simple tool that verifies the types
affected by an aspect in accordance with simple rules like "master aspects X and Y
can affect everything, but aspect Z should only affect types in packages A..*" That
gets you out of using build phases to enforce architecture rules. Another language
locution would be to declare a scope for aspects, e.g.,
declare scope: com.xyz.app..* : LockingAspect+;
</beniceif>
Wes
> ------------Original Message------------
> From: "Seva Popov" <seva_popov@xxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Mar-23-2006 11:54 AM
> Subject: [aspectj-users] LTW and build-time weaving used together result in an unexpected org.aspectj.bridge.AbortException
>
> Hi,
>
> In our company we are considering the possibility to use LTW and
> build-time weaving together with AspectJ 1.5. What I mean is that we would
> like to allow LTW only for the "global" aspects (i.e. those that
> crosscut all our codebase) only in our system level jars (that are audited
> more carefully and owned by a more senior developers). At the same time
> we do not want to let the rest of our projects to have aspects that are
> weaved at load-time. However, we still want them to be able to use
> AspectJ at compile/build time should they have a need. The reason is that
> we just do not want some negligent, too broad pointcut definitions
> coming from some regular jar file with the LTW approach to "accidentally"
> harm/break other code in the system. This sounds like a safer approach
> for us.
>
> Anyway, closer to my question.
>
> >From what I know so far with the LTW one has to declare all the
> aspects in the aop.xml files even if the aspect was already weaved into the
> desired classes. The AspectJ will issue an ERROR logging with the stack
> trace if some aspect is not declared. In spite of that ERROR
> reporting, everything seems to work okay for us.
>
> So, I'd like to understand why the described situation considered an
> error by AspectJ. I would expect just a warning message from AspectJ just
> saying that an aspect is found that is not declared (i.e. there is no
> LTW for this aspect).
>
> Below is the relevent output from AspectJ with an error message and a
> stack trace:
>
> info processing reweavable type
> com.metatv.user.hibernate.HibernateUserFactory: com\metatv\user\hibernate\HibernateUserFactory.java
> error aspect 'com.metatv.user.hibernate.TransactionManager' woven into
> 'com.metatv.user.hibernate.HibernateUserFactory' must be declared in an
> aop.xml file.
> Message: error aspect 'com.metatv.user.hibernate.TransactionManager'
> woven into 'com.metatv.user.hibernate.HibernateUserFactory' must be
> declared in an aop.xml file.
> org.aspectj.bridge.AbortException: aspect
> 'com.metatv.user.hibernate.TransactionManager' woven into
> 'com.metatv.user.hibernate.HibernateUserFactory' must be declared in an aop.xml file.
> at
> org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:413)
> at org.aspectj.weaver.World.showMessage(World.java:550)
> at
> org.aspectj.weaver.bcel.BcelWeaver.processReweavableStateIfPresent(BcelWeaver.java:1244)
> at
> org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1024)
> at
> org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:277)
> at
> org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:210)
> at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:65)
> at
> org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)
> at
> sun.instrument.TransformerManager.transform(TransformerManager.java:122)
>
> Thanks,
> Seva
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>