Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW in JBoss 4

Hi,

Seeing 'debug weaving' but no 'weaveinfo' suggests your pointcuts just
don't match.

Actually, if I go back to your pointcut it says:

within(com.example.*) && call(* *(..));

Which means 'any call made from inside com.example.*'.  Because you
used .* and not ..* it will not be including subpackages of
com.example.<anything> - I hope that is what you intended to do? As
you mentioned it was doing what you expect on the command line, I
assumed the pointcuts were OK.  Maybe try something even more simple
to check the mechanism is ok?  something like

before(): staticinitialization(*) {
System.out.println("staticinitialization"); }

Andy

2011/5/24 Bernhard Berger <berber@xxxxxx>:
> Thank you very much, Andy, for the link. I added to the configuration
> -debug as well as -showWeaveInfo. This results in a long list of
> messages where he tells that he weaves the application classes, for
> instance:
>
> [UnifiedClassLoader@...] debug weaving 'com.example.foo.Bar'
>
> But he does not apply the aspect I have defined (there is no weaveinfo
> in the log).
>
> Bernhard
>
> On Di, 2011-05-24 at 22:45 -0700, Andy Clement wrote:
>> Hi Bernhard,
>>
>> You could refer to my article here for all the debug options around ltw:
>>
>> http://andrewclement.blogspot.com/2009/02/load-time-weaving-basics.html
>>
>> Beyond -verbose it talks about -debug - this option will actually tell
>> you what classes are being passed to the weaver for weaving.
>>
>> I'm sorry I can't answer specific info about JBoss though, there may
>> be something extra that needs configuring if it is using some kind
>> of unusual classloader hierarchies.
>>
>> Andy
>>
>> 2011/5/24 Bernhard Berger <berber@xxxxxx>:
>> > On Di, 2011-05-24 at 16:31 +0200, Pasturel wrote:
>> >> Le 24/05/2011 15:37, Bernhard Berger a écrit :
>> >> > Hi,
>> >> >
>> >> > I have some problems with instrumenting a java enterprise application,
>> >> > which perhaps is not a AspectJ issue. Maybe someone of you can help me.
>> >> > Currently I'm trying to trace an enterprise application deployed to a
>> >> > JBoss 4 server. My idea is to add a trace aspect to every call within a
>> >> > certain package to extract a run-time call-graph.
>> >> > I have implemented a small aspect and created a pointcut matching all
>> >> > classes:
>> >> >      pointcut myMethodCalls(): within(com.example.*)&&  call(* *(..));
>> >> >
>> >> > The aspect snippets call a tracer class before and after the call:
>> >> > before() : myMethodCalls() {
>> >> >    TraceMonitor.enterMethod(thisJoinPoint,
>> >> > thisEnclosingJoinPointStaticPart);
>> >> > }
>> >> >
>> >> > after() : myMethodCalls() {
>> >> >    TraceMonitor.leaveMethod(thisJoinPoint);
>> >> > }
>> >> >
>> >> > When instrumenting a commandline application, everything is working fine
>> >> > and I receive the result I expect. But when I copy this to JBoss the
>> >> > aspect is not added to the classes. BTW: I'm using LTW because I want
>> >> > AspectJ to add the aspect to all classes (even to the one that are
>> >> > generated at runtime).
>> >> >
>> >> > The only result I can see are tons of log messages like this:
>> >> > [2@63cd66ea] info AspectJ Weaver Version 1.6.11 built on Tuesday Mar 15,
>> >> > 2011 at 15:31:04 GMT
>> >> > [2@63cd66ea] info register classloader org.jboss.mx.util.MBeanProxyExt
>> >> > $2@63cd66ea
>> >> > [2@63cd66ea] info using configuration /C:/test/bin/aop.xml
>> >> > [2@63cd66ea] info register aspect de.uni_bremen.st.berber.aspectj.Trace
>> >> >
>> >> > which shows me that AspectJ is running but the fact that the classes are
>> >> > not instrumented shows me, that I missed something. Perhaps some
>> >> > configuration settings for JBoss. Can someone give me a hint?
>> >> >
>> >> > Thanks in advance
>> >> >
>> >> > Bernhard
>> >>
>> >> I suppose that the file /C:/test/bin/aop.xml declares the aspect. turn
>> >> on  verbose mode in aop.xml
>> >>
>> >> Other way, JBoss has its own AOP weaver, => javassist . Perhaps a
>> >> precedence between aspectj and javassist
>> >
>> > My aop.xml contains the line:
>> >
>> > <weaver options="-verbose" />
>> >
>> > and I'm enhanced the run script to add the following parameters to
>> > jboss:
>> >
>> > -javaagent:c:\test\aspectjweaver.jar -Daj.weaving.verbose=true
>> > -Dorg.aspectj.weaver.showWeaveInfo=true -Daj.weaving.debug=true
>> > -Daj.weaving.trace=true
>> > -Dorg.aspectj.weaver.loadtime.configuration=aop.xml -classpath "%
>> > JBOSS_CLASSPATH%;c:\test\bin"
>> >
>> > The aop.xml and the aspect can be found in c:\test\bin. And in the log
>> > there are very often the lines:
>> >
>> > 2011-05-25 06:32:35,277 ERROR [STDERR] [2@41d47b2b] info AspectJ Weaver
>> > Version 1.6.11 built on Tuesday Mar 15, 2011 at 15:31:04 GMT
>> > 2011-05-25 06:32:35,277 ERROR [STDERR] [2@41d47b2b] info register
>> > classloader org.jboss.mx.util.MBeanProxyExt$2@41d47b2b
>> > 2011-05-25 06:32:35,277 ERROR [STDERR] [2@41d47b2b] info using
>> > configuration /C:/test/bin/aop.xml
>> > 2011-05-25 06:32:35,292 ERROR [STDERR] [2@41d47b2b] info register aspect
>> > de.uni_bremen.st.berber.aspectj.Trace
>> >
>> > ...
>> >
>> > 2011-05-25 06:32:36,135 ERROR [STDERR] [2@4ca68fd8] info AspectJ Weaver
>> > Version 1.6.11 built on Tuesday Mar 15, 2011 at 15:31:04 GMT
>> > 2011-05-25 06:32:36,135 ERROR [STDERR] [2@4ca68fd8] info register
>> > classloader org.jboss.mx.util.MBeanProxyExt$2@4ca68fd8
>> > 2011-05-25 06:32:36,135 ERROR [STDERR] [2@4ca68fd8] info using
>> > configuration /C:/test/bin/aop.xml
>> > 2011-05-25 06:32:36,150 ERROR [STDERR] [2@4ca68fd8] info register aspect
>> > de.uni_bremen.st.berber.aspectj.Trace
>> >
>> > ...
>> >
>> > 2011-05-25 06:34:08,809 ERROR [STDERR] [JasperLoader@331a0501] info
>> > AspectJ Weaver Version 1.6.11 built on Tuesday Mar 15, 2011 at 15:31:04
>> > GMT
>> > 2011-05-25 06:34:08,809 ERROR [STDERR] [JasperLoader@331a0501] info
>> > register classloader org.apache.jasper.servlet.JasperLoader@331a0501
>> > 2011-05-25 06:34:08,825 ERROR [STDERR] [JasperLoader@331a0501] info
>> > using configuration /C:/test/bin/aop.xml
>> > 2011-05-25 06:34:08,825 ERROR [STDERR] [JasperLoader@331a0501] info
>> > register aspect de.uni_bremen.st.berber.aspectj.Trace
>> >
>> > Entries that he advises some joinpoints is missing. I even deleted the
>> > javassist.jar from the deployment directory to make sure he isn't using
>> > it.
>> >
>> > Regards
>> >
>> > Bernhard
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top