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

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



Back to the top