Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Monitoring JBOSS

On Tuesday 08 April 2003 10.01, garcia@xxxxxxxxx wrote:
> Hi everybody, I'm trying to monitor JBOSS's behaviour using AOP. I'm
> interested in monitoring javax.servlet.Servlet.service(...)  and
> org.jboss.ejb.Container.invoke(...) method's execution.
> I got no problem monitoring servlets but got some troubles when monitoring
> container's invokes.

JBoss does a lot of classloader trickery and i suspect that this might in some 
way be related to you problem. System.out might be redirected to  a logfile
or i may simply be ignored. I belive JBoss either has it's own logging api or 
is using log4j and i recommend trying to do the logging that way.

Also JBoss builds some classes from scratch during runtime, possibly by using 
the java proxy classes and this might also subvert the aspect binding, but I 
don't know enough about when and how aspectj binds the aspects to the classes 
to be able to determine if this might be the case here.

A lot of the work in JBoss is done by dynamic invocation and clever use of 
classloaders and if you can get your aspect working outside of jboss the 
cause is proably to be found somewhere in that area.

>
> I created the following aspect file:
>
>
> aspect container {
> pointcut po0_execution (org.jboss.ejb.Container objo,java.lang.String
> p0,java.lang.Object[] p1,java.lang.String[]
> p2):target(objo)&&(execution(java.lang.Object
> invoke(java.lang.String,java.lang.Object[],java.lang.String[])))&&args(p0,
> p1, p2);
>
> before(org.jboss.ejb.Container objo,java.lang.String p0,java.lang.Object[]
> p1,java.lang.String[] p2):po0_execution(objo,p0, p1, p2){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> Parameter 0:java.lang.String p0
> Parameter 1:java.lang.Object[] p1
> Parameter 2:java.lang.String[] p2
> */
> System.out.println("Someone is invoking me");
> }
> after(org.jboss.ejb.Container objo,java.lang.String p0,java.lang.Object[]
> p1,java.lang.String[] p2):po0_execution(objo,p0, p1, p2){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> Parameter 0:java.lang.String p0
> Parameter 1:java.lang.Object[] p1
> Parameter 2:java.lang.String[] p2
> */
>
> }
> pointcut po1_execution (org.jboss.ejb.Container
> objo):target(objo)&&(execution(void start()));
>
> before(org.jboss.ejb.Container objo):po1_execution(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
> System.out.println("start");
> }
> after(org.jboss.ejb.Container objo):po1_execution(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
>
> }
> pointcut po2_execution (org.jboss.ejb.Container
> objo):target(objo)&&(execution(void stop()));
>
> before(org.jboss.ejb.Container objo):po2_execution(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
> System.out.println("stop");
> }
> after(org.jboss.ejb.Container objo):po2_execution(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
>
> }
> pointcut po3_call (org.jboss.ejb.Container objo,java.lang.String
> p0,java.lang.Object[] p1,java.lang.String[]
> p2):target(objo)&&(call(java.lang.Object
> invoke(java.lang.String,java.lang.Object[],java.lang.String[])))&&args(p0,
> p1, p2);
>
> before(org.jboss.ejb.Container objo,java.lang.String p0,java.lang.Object[]
> p1,java.lang.String[] p2):po3_call(objo,p0, p1, p2){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> Parameter 0:java.lang.String p0
> Parameter 1:java.lang.Object[] p1
> Parameter 2:java.lang.String[] p2
> */
>
> }
> after(org.jboss.ejb.Container objo,java.lang.String p0,java.lang.Object[]
> p1,java.lang.String[] p2):po3_call(objo,p0, p1, p2){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> Parameter 0:java.lang.String p0
> Parameter 1:java.lang.Object[] p1
> Parameter 2:java.lang.String[] p2
> */
>
> }
> pointcut po4_call (org.jboss.ejb.Container objo):target(objo)&&(call(void
> start()));
>
> before(org.jboss.ejb.Container objo):po4_call(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
> System.out.println("call start");
> }
> after(org.jboss.ejb.Container objo):po4_call(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
>
> }
> pointcut po5_call (org.jboss.ejb.Container objo):target(objo)&&(call(void
> stop()));
>
> before(org.jboss.ejb.Container objo):po5_call(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
> System.out.println("call stop");
> }
> after(org.jboss.ejb.Container objo):po5_call(objo){
> /*You can acces to those objects using their name
> Caller object :org.jboss.ejb.Container objo
> */
>
> }
> }
>
> But nothing is displayed in the screen :(. Does anybody has any clues about
> what's happenning and why those message aren't displayed ?.
>
> Thanks everybody.
>
> Dave Garcia
>
> Politecnical University of Catalonia.
>
>
/Mikael Andersson


Back to the top