RE: [aspectwerkz-user] help with aspect not weaved

[email protected] Thu, 23 Jun 2005 10:29:13 -0400
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <3E62A5A0B8058845984FFA345CE894F2060CBF1F@NSTMC007PEX1.ubsgs.ubsgroup.net>
Hi,

Tracing helped, but it took a while :( The error in that trace that led me to the source cause of the problem was a "Class not found" thrown from org.objectweb.asm.ClassReader. Because I get so many of those and, as you explained at some point, they can be safely ignored, I didn't pay much attention. 

However, it turned out it wasn't able to load the aspect class itself simply because it wasn't specified in the XML.  I had:

<aspect name="test.com.ubs.firc.support.aspect.GenericMethodDecorator" 
     deployment-model="perInstance">

instead of

<aspect class="test.com.ubs.firc.support.aspect.GenericMethodDecorator" 
   deployment-model="perInstance">

as you can see below ;)

Anyway, very stupid mistake, but I had to go from line to line in the callstack of the exception to figure it out. I would suggest to add more explicit and user-friendly config file validation for the next release (like "class attribute is mandatory for aspect tag" ;).

I have some more problems now, but I'll see if I can sort them out by myself first...

Thanks a lot!
Boris

|-----Original Message-----
|From: Alexandre Vasseur [mailto:[email protected]]
|Sent: Thursday, June 23, 2005 3:38 AM
|To: [email protected]
|Subject: Re: [aspectwerkz-user] help with aspect not weaved
|
|
|HI
|The following may help (I assume you are using 2.0)
|
|Use -Daspectwerkz.transform.details=true
|to see if the pointcut captures what it should.
|
|Use -Daspectwerkz.transform.verbose=true (or -verbose:class) to see
|when the ejbPrioEJBHelper class gets weaved and loaded (I am assuming
|you are using load time weaving).
|
|I don' t understand what you mean by 
|"all Aspects.aspectOf methods throw an exception saying that 
|no aspect is found"
|Could you provide more details ?
|
|Also I see you are using "perInstance" with a call pointcut. I would
|say this is a flaw that we unfortunately provide. You should consider
|using a perTarget(...some pointcut....) where some pointcut captures
|the creation of the ejbPrionEJBHelper instances.
|perInstance is likely to be perInstance from the caller point of view
|and you seem to wish the callee in this case.
|
|Alex
|
|
|On 6/22/05, [email protected] 
|<[email protected]> wrote:
|> Hi,
|> 
|> I have the following aspect:
|> 
|>     <aspect 
|name="test.com.ubs.firc.support.aspect.GenericMethodDecorator" 
|deployment-model="perInstance">
|>       <pointcut name="helper" expression="call(* 
|com.ubs.firc.credit..ejbPrionEJBHelper.*(..))"/>
|>       <advice name="decorate" type="around" bind-to="helper"/>
|>     </aspect>
|> 
|> in my aop.xml. Basically, I want to put an around advice 
|around all methods of the class 'ejbPrionEJBHelper'. The 
|aspect is not applied as all Aspects.aspectOf methods throw an 
|exception saying that no aspect is found. I put the verbose 
|mode to trace all AspectWerkz activity, and I see things like 
|this in the console:
|> 
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:com.ubs.firc.
|credit.jrisk2003_2.external.valuation.ExternalValuationDebug[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.OperatingSystem[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.MiscUtilities[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.io.VFSManager[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.JARClassLoader[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.io.VFS[main]
|> 
|sun.misc.Launcher$AppClassLoader@1813fac@25247660:org.gjt.sp.je
|dit.io.FileVFS[main]
|> 
|> etc...
|> 
|> However, there's no trace of loading of my class of interest 
|'ejbPrionEJBHelper'. Does that mean that AspectWerkz simply 
|never intersepts the loading of that class (I'm sure it 
|eventually gets loaded because I instantiated it)?  I also 
|tried putting the full package name instead of the '..' 
|construct. This is not running in an EJB container, nevermind 
|the name of ejbPrionEJBHelper - it's a simple helper class 
|that doesn't use J2EE API.
|> 
|> Any idea how I could debug this problem?
|> 
|> Thanks,
|> Boris
|> 
|> Visit our website at http://www.ubs.com
|> 
|> This message contains confidential information and is intended only
|> for the individual named.  If you are not the named addressee you
|> should not disseminate, distribute or copy this e-mail.  Please
|> notify the sender immediately by e-mail if you have received this
|> e-mail by mistake and delete this e-mail from your system.
|> 
|> E-mail transmission cannot be guaranteed to be secure or error-free
|> as information could be intercepted, corrupted, lost, destroyed,
|> arrive late or incomplete, or contain viruses.  The sender therefore
|> does not accept liability for any errors or omissions in the contents
|> of this message which arise as a result of e-mail transmission.  If
|> verification is required please request a hard-copy version.  This
|> message is provided for informational purposes and should not be
|> construed as a solicitation or offer to buy or sell any securities or
|> related financial instruments.
|> 
|>
|

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.