Re: [aspectwerkz-user] help with aspect not weaved
Alexandre Vasseur <[email protected]> Thu, 23 Jun 2005 18:39:47 +0200
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
Are you running in an application server ? Or can you reproduce it in a standalone sample ? You may use -Daspectwerkz.transform.dump=* to get this magic class et.appl.jrisk.security.JRiskSecurity_1__2130939767_1948679980_ |__AW_JoinPoint bytecode and send it to me so that I can see what s going on. It is usually a classpath issue ie the aspect is not visible from the weaved class. Could that be the case in your system ? Alex On 6/23/05, [email protected] <[email protected]> wrote: > Hi, > > I removed the deployment-model attribute, but that didn't help. I'm using the official 2.0 release. > > Thanks, > Boris > > |-----Original Message----- > |From: Alexandre Vasseur [mailto:[email protected]] > |Sent: Thursday, June 23, 2005 12:02 PM > |To: [email protected] > |Subject: Re: [aspectwerkz-user] help with aspect not weaved > | > | > |I suspect the class cast is about the perClass aspect. > |Can you try with a singleton (just remove deployment-model=..) > |Which AW version is that ? > | > |On 6/23/05, [email protected] > |<[email protected]> wrote: > |> Hi, > |> > |> Perhaps I will need a little bit of help with this. I'm > |getting the following exception: > |> > |> java.lang.ClassCastException at > |net.appl.jrisk.security.JRiskSecurity_1__2130939767_1948679980_ > |__AW_JoinPoint.invoke(Unknown Source) at > |net.appl.jrisk.security.JRiskSecurity.login(JRiskSecurity.java) > | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > |Method) at > |sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso > |rImpl.java:39) at > |sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho > |dAccessorImpl.java:25) > |> > |> The advised method's signature is: > |> > |> public static SecurityContext JRiskSecurity.login(String, > |String) throws SecurityException > |> { ... } > |> > |> And the advice looks like this: > |> > |> public Object decorate(JoinPoint joinPoint) throws Throwable > |> { > |> return null; > |> } > |> > |> I have only one aspect applied and only to that method: > |> > |> <aspectwerkz> > |> <system id="testenv"> > |> <pointcut name="helper" expression="execution(* > |net.appl.jrisk.security.JRiskSecurity.login(String,String))"/> > |> <aspect > |class="test.com.ubs.firc.support.aspect.GenericMethodDecorator" > | deployment-model="perClass"> > |> <advice name="decorate" type="around" bind-to="helper"/> > |> </aspect> > |> </system> > |> </aspectwerkz> > |> > |> It looks like JoinPoint.proceed() is called after the return > |from my advice. I hope the call is made in order to handle > |other potential advices and not calling the real method. > |Anyway, why would it throw a ClassCastException? > |> > |> Thanks again, > |> Boris > |> > |> |-----Original Message----- > |> |From: Alexandre Vasseur [mailto:[email protected]] > |> |Sent: Thursday, June 23, 2005 10:33 AM > |> |To: Iordanov, Borislav > |> |Cc: [email protected] > |> |Subject: Re: [aspectwerkz-user] help with aspect not weaved > |> | > |> | > |> |Great ! > |> |I actually got screwed my self for some ours by this XML > |one so it is > |> |fixed in the CVS hence will be checked in the next versions. > |> |Alex > |> | > |> |On 6/23/05, [email protected] > |> |<[email protected]> wrote: > |> |> 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. > |> |> > |> |> > |> | > |> > |> 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. > >