| Re: [aspectj-users] hooking into app server |
|
I am fairly new (just a few days) to aspectj but after some initial
problems am now doing this, (but perhaps not doing it the best way). Here are the things i am doing: Note: for a while i could not get things to work,. It was hard to find out what was going wrong, e.g. no logs. * In the Glassfish Admin Console (e.g. port 4848)/Application Server/JVM Settings/JVM Options I added -javaagent:<path>\aspectjweaver.jar -Daj.weaving.verbose=true Question#1: I wish i knew all of the -D options, and what they did?? * I place my aspects-filter.jar right now in glassfish/domains/domain1/lib I had better success when i narrowed down my aspect's scope. Question#2: If i place it in the application classpath MY_APP/WEB-INF/lib will the weaving only apply to the classes loaded by the application classloader * build.xml <iajc srcdir="${src.dir}/aop" destdir="${build.dir}/aop" debug="true" source="1.6" target="1.6"> <classpath refid="compile.class.path" /> </iajc> Note: I believe this defaults to 1.3 or something. I had better success after changing this * WEB-INF/aop.xml <aspectj> <aspects> <aspect name="aspects.FilterAspect" /> </aspects> <weaver options="-XmessageHandlerClass:aspects.AspectJMessageHandler"> <!-- <weaver options="-verbose -showWeaveInfo"> --> <dump within="blah.*"/> </weaver> </aspectj> Question#3: I wish i knew all of the weaver options, and what they did?? Question#4: I wish you could configure where to dump the classes?? Note: There are not many good examples of this aop.xml file * IMessageHandler I had better success after i started using this. package aspects; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessage.Kind; public class AspectJMessageHandler implements org.aspectj.bridge.IMessageHandler { public void dontIgnore(Kind arg0) { } public boolean handleMessage(IMessage arg0) throws AbortException { // note i actually write the message to a log, basically log(new Date() + " " + arg0) return true; } public void ignore(Kind arg0) { } public boolean isIgnoring(Kind arg0) { return false; } } * Questions: What does this mean?? debug weaving 'com.sun.jbi.filebc.extensions.FileExtensionRegistry' info AspectJ Weaver Version 1.6.1 built on Thursday Jul 3, 2008 at 18:35:41 GMT info register classloader com.sun.jbi.framework.CustomClassLoader@1af5d23 a) this line info using configuration file:/C:/glassfish/domains/domain1/lib/aspects-filter.jar!/META-INF/aop.xml info register aspect aspects.FilterAspect debug weaving 'com.sun.encoder.MetaRef' b) this line ... debug weaving 'org.apache.xml.resolver.readers.OASISXMLCatalogReader' debug weaving 'org.apache.xml.resolver.readers.SAXCatalogParser' debug cannot weave 'javax.wsdl.factory.WSDLFactory' debug cannot weave 'javax.wsdl.WSDLException' debug cannot weave 'javax.wsdl.factory.WSDLFactory$1' c) this line Andy Clement wrote:
|