Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] newbie needs help configuring

Here are the details:

Given an @Aspect aspect, as you can see in your own code there is no
aspectOf() method (as there are implicit ones in the non @Aspect
aspectj syntax). This method is wether
- injected into the compiled aspect if you compile this one with ajc
- injected into the javac compiled aspect during load time weaving
In both case all that is transparent to you.


so it looks like you have hit some issue with the second option as
switching to the 1st one shows that your configuration and aspect is
valid.
I would appreciate if you could describe where you package the javac
compile aspect (alongside the webapp or in some other level like fe.
tomcat shared classes) or if you could try to narrow down the issue
outside of a tomcat.

Alex

On 10/14/05, Andy Kriger <andy.kriger@xxxxxxxxx> wrote:
> And finally, I used ajc to compile my source and run the same test and
> it worked. So maybe a combination of Annotations and load-time weaving
> is causing the problem?
>
> On 10/14/05, Andy Kriger <andy.kriger@xxxxxxxxx> wrote:
> > When I try the call outside the web application, I get this error...
> >  [junit] Testcase: testAOP(com.myco.AOPTest): Caused an ERROR
> >  [junit] com.myco.MyAspect.aspectOf()Lcom/myco/MyAspect;
> >  [junit] java.lang.NoSuchMethodError:
> > com.myco.MyAspect.aspectOf()Lcom/myco/MyAspect;
> >
> > That looks pretty significant - any idea what it means? Have I missed
> > something in implementing my Aspect or the way I'm using the
> > Annotations?
> >
> > On 10/14/05, Andy Kriger <andy.kriger@xxxxxxxxx> wrote:
> > > 1. Yep, using Java 5
> > > 2. Haven't tried static weaving or logging outside the webapp/SOAP
> > > call - I'll try those and post a followup.
> > > 3. Here's what I see in the LTW log...
> > > info weaving 'com/myco/Service'
> > > info weaver operating in reweavable mode.  Need to verify any required
> > > types exist.
> > > weaveinfo Join point 'method-execution(boolean
> > > com.myco.Service.isXml(java.lang.String))' in Type 'com.myco.Service'
> > > (Service.java:2469) advised by after advice from 'com.myco.MyAspect'
> > > (MyAspect.java)
> > > weaveinfo Join point 'method-execution(java.lang.String
> > > com.myco.Service.generateXML(java.lang.String))' in Type
> > > 'com.myco.Service' (Service.java:2474) advised by after advice from
> > > 'com.myco.MyAspect' (MyAspect.java)
> > > etc etc etc for all the methods in Service
> > >
> > > I never see it reach a point where AspectJ logs a message about a
> > > Service method call or " info weaving 'com/myco/MyAspect' ".
> > >
> > > Thanks for the help,
> > > Andy
> > >
> > > On 10/14/05, Matthew Webster <matthew_webster@xxxxxxxxxx> wrote:
> > > >
> > > > Andy,
> > > >
> > > > Hopefully these questions won't seem too silly:
> > > > 1. The @AspectJ syntax requires Java 5 so I assume you are using that to run
> > > > AXIS?
> > > > 2. Have you tried static weaving your application and testing it either
> > > > outside (JUnit) or inside AXIS that way?
> > > > 3. Could you post the LTW log or a least the interesting part of it?
> > > >
> > > > I have successfylly tried you testcase with my own simple Service class:
> > > >
> > > >
> > > > info weaving 'com/myco/Service'
> > > > info weaver operating in reweavable mode.  Need to verify any required types
> > > > exist.
> > > > weaveinfo Join point 'method-execution(void
> > > > com.myco.Service.main(java.lang.String[]))' in Type 'com.myco.Service'
> > > > (Service.java:6) advised by after advice from 'com.myco.MyAspect'
> > > > (MyAspect.java)
> > > > Service.main()
> > > > info weaving 'com/myco/MyAspect'
> > > > info weaver operating in reweavable mode.  Need to verify any required types
> > > > exist.
> > > > info processing reweavable type com.myco.MyAspect: com\myco\MyAspect.java
> > > > info successfully verified type com.myco.MyAspect exists.  Originates from
> > > > com\myco\MyAspect.java
> > > > Aspect logXyPath was called
> > > >
> > > > Cheers
> > > >
> > > > Matthew Webster
> > > >  AOSD Project
> > > >  Java Technology Centre, MP146
> > > >  IBM 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/
> > > >
> > > > Please respond to aspectj-users@xxxxxxxxxxx
> > > >
> > > > Sent by:        aspectj-users-bounces@xxxxxxxxxxx
> > > >
> > > > To:        aspectj-users@xxxxxxxxxxx
> > > > cc:
> > > > Subject:        Re: [aspectj-users] newbie needs help configuring
> > > >
> > > >
> > > > The stack trace isn't really meaningful since the only trace I see is
> > > >  an Axis SOAP Fault that wraps (and masks) the exception being thrown
> > > >  from within the web application. I cannot see where the trace
> > > >  originates only really the InvocationTargetException. There's nothing
> > > >  in the logs that indicates what problem, if any, AspectJ is having. I
> > > >  already have the verbose switch in the aop.xml. If there's a way to
> > > >  turn on more logging, please let me know.
> > > >
> > > >  On 10/13/05, Alexandru Popescu
> > > > <the.mindstorm.mailinglist@xxxxxxxxx> wrote:
> > > >  > #: Andy Kriger changed the world a bit at a time by saying on  10/13/2005
> > > > 11:06 PM :#
> > > >  > > I am trying to use load-time weaving in AspectJ 1.5M4 to log our web
> > > >  > > service running on Axis 1.2 in Tomcat 5.8. Right now I'm trying to get
> > > >  > > a very simple proof-of-concept working. I make calls to web service
> > > >  > > methods expecting to see logging to stdout and instead I keep running
> > > >  > > into InvocationTargetExceptions. I've included my config below.
> > > >  > >
> > > >  > > If I comment out the Advice part of MyAspect, everything works fine.
> > > >  > > I've tried @Before as well as @After - no luck there. I do see
> > > >  > > "weaveinfo Join point..." info in the logs, so things look like they
> > > >  > > are being woven. Logging in my code shows everything working through
> > > >  > > the service method being invoked and then mysteriously throwing the
> > > >  > > InvocationTargetEception. I can only guess that it's coming from the
> > > >  > > Advice. I've also tried applying the advice to the class invoked by
> > > >  > > the service (in case there's some kind of reflection effect from Axis)
> > > >  > > but I still see the same problem.
> > > >  > >
> > > >  > > I really want to show my boss that AOP is valid for our project but
> > > >  > > right now I'm dead in the water. Can someone can help me figure out
> > > >  > > what's going on?
> > > >  > >
> > > >  > > Thanks in advance,
> > > >  > > Andy
> > > >  > >
> > > >  > > Tomcat is configured to run with the JVM opt
> > > >  > >
> > > > -javaagent:/usr/local/tomcat/shared/lib/aspectjweaver.jar
> > > >  > > and shared/lib contains the lib/*.jar files from the AspectJ distro
> > > >  > >
> > > >  > > Here's my aop.xml
> > > >  > >
> > > >  > > <aspectj>
> > > >  > >       <aspects>
> > > >  > >                <aspect name="com.myco.MyAspect"/>
> > > >  > >       </aspects>
> > > >  > >       <weaver options="-verbose -showWeaveInfo">
> > > >  > >               <include within="com.myco.*"/>
> > > >  > >       </weaver>
> > > >  > > </aspectj>
> > > >  > >
> > > >  > > Here's my aspect
> > > >  > >
> > > >  > > package com.myco;
> > > >  > >
> > > >  > > @Aspect
> > > >  > > public class MyAspect
> > > >  > > {
> > > >  > >
> > > >  > > // on any call to our service
> > > >  > > @Pointcut("execution( public * com.myco.Service.*(..) )")
> > > >  > > void csCall() {}
> > > >  > >
> > > >  > > // log something
> > > >  > > @After("csCall()")
> > > >  > > public void logPath()
> > > >  > > {
> > > >  > >       System.out.println("Aspect logXyPath was called");
> > > >  > > }
> > > >  > >
> > > >  > > }
> > > >  >
> > > >  > Can you add to the aboves the stacktrace you are getting?
> > > >  >
> > > >  > ./alex
> > > >  > --
> > > >  > .w( the_mindstorm )p.
> > > >  >
> > > >  > _______________________________________________
> > > >  > aspectj-users mailing list
> > > >  > aspectj-users@xxxxxxxxxxx
> > > >  > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >  >
> > > >  _______________________________________________
> > > >  aspectj-users mailing list
> > > >  aspectj-users@xxxxxxxxxxx
> > > >  https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > aspectj-users mailing list
> > > > aspectj-users@xxxxxxxxxxx
> > > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > > >
> > > >
> > >
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top