Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] LTW on tomcat 5.5.12, the server stuck

Hi Guofeng,

This sounds like a log4j configuration issue. Do you have one copy of
log4j.properties and does it enable the right kind of logging. I can't see
which loggers are emitting the output, but what you describe suggests that
the properties allow output for initialization but not when viewing the
file. This could also be a function of something changing log properties.

Earlier, when you tried deploying to shared/lib, did you have log4j
installed in the same place? If you do deploy in this way, you can configure
a log4j.properties for your aspect in shared/lib.

Here are a couple of system properties you might try using to debug how
log4j is configured:

1) Use -Dlog4j.debug to see how it is being configured
2) Use -Dlog4j.configuration=testLog4j.properties - this will let you be
sure you are pointing a the file you expect

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Guofeng Zhang
Sent: Monday, October 31, 2005 1:31 AM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] LTW on tomcat 5.5.12, the server stuck

I use load time weaving. A aspject jar is build by Eclipse, and my
application is built by ant in a separate directory.

I find that the reason might be caused by log4j. 
   (1)If I use System.out in the aspect code, I can see the trace output
on the Console as I expected. 
   (2)If I use log4j, I can see the trace output on the console and in
the file when my servlet is being initialized/loading by tomcat. But
when I use the browser to access my servlet, no trace output appears on
the console or in the log file. 

The aspect is similar to the tracing example in aspctj 1.5 doc. I change
it to use log4j to output the traces.

I deploy the aspect jar and log4j.jar in WEB-INF/lib.

The following is the aspectj code and aop.xml. TraceSupport indent and
output the entry and exit message.

public aspect TracingAspect {

	pointcut myMethod(): 
	      !within(TracingAspect) && !within(TraceSupport) 
	      && execution(* *(..)) && !execution(String toString());

    pointcut myConstructor():
          !within(TracingAspect) && !within(TraceSupport)
    	  && execution( new(..) );

    before(): myConstructor() {
    	TraceSupport.traceEntry( thisJoinPoint.getSourceLocation() + " "
+ thisJoinPointStaticPart.getSignature());
    }
    after(): myConstructor() {
    	TraceSupport.traceExit( thisJoinPoint.getSourceLocation() + " "
+ thisJoinPointStaticPart.getSignature());
    }

    before(): myMethod() {
    	TraceSupport.traceEntry( thisJoinPoint.getSourceLocation() + " "
+ thisJoinPointStaticPart.getSignature());
    }
    after(): myMethod() {
    	TraceSupport.traceExit( thisJoinPoint.getSourceLocation() + " "
+ thisJoinPointStaticPart.getSignature());
    }
}

Aop.xml
<aspectj>

            <aspects>
              <aspect name="com.gf.tracing.TracingAspect"/>
            </aspects>

            <weaver options="-verbose -XlazyTjp">
              <include within="com.radvision.nms..*"/>
            </weaver>
</aspectj>



-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
Sent: Monday, October 31, 2005 2:51 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] LTW on tomcat 5.5.12, the server stuck

Hi Guofeng,

I'm assuming you have configured your aspects correctly using the
META-INF/aop.xml description file. The symptom you are describing sounds
like you haven't. Could you post an example of your META-INF/aop.xml
file?
Alternatively, do you have both compile-time and load-time weaving?

The LTW system is classloader aware: aspects will only apply to classes
loaded by their classloader or another classloader that sees their
definition (typically a parent classloader). So if you install aspects
and
their META-INF/aop.xml definition file in Tomcat's common folder (either
exploded into common/classes or a jar in common/lib), they will apply to
almost all of Tomcat (except bootstrap code), and all Web applications
in
the system. If you install to shared, they will apply to all apps but
not
the container. If you install to WEB-INF, they will apply to a single
application. Putting your aspects and their definition into the system
classpath will affect everything but the Java bootstrap and ext
classloaders.

In general, there is more memory and startup time overhead in weaving
into
more code, so if you have an application-specific set of aspects, I'd
deploy
them just into WEB-INF/lib (this would still allow you to affect
application
libraries).




-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Guofeng Zhang
Sent: Sunday, October 30, 2005 10:23 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] LTW on tomcat 5.5.12, the server stuck


If I put the aspects in shared/lib, it does not work. If I put the
aspects in WEB-INF/lib, it works. But it seems that the aspect is only
invoked when my servlet is being initialized. If I access the servlet by
the browser, it seems that the aspect is not invoked.

What the relationship between the LTW and the classloader? If I only
weave into my classes in the web application, should I put the aspects
in the classpath for the system classloader?

Thanks

Guofeng

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top