Nov 5th, 2010, 12:01 PM
tc Server and Server Scope LTW
I have a problem but as that's way too personal to discuss here, I would like to bring up another problem I appear to be having.
I am using the STS IDE with its included tc Server instance and am using the default settings for all.
I want to have aspects operating at the server scope level (i.e. that is they are able to advise classes across all web applications). To this effect, I have compiled those aspects into a JAR file and put it in the following directory...
The classes in this JAR appear to be available throughout the server instance (at least to the web applications anyway).
I realize that these aspects are loaded by a non-weaving class loader but I am relying upon the respective web application's weaving class loader to do the LTW (at least that's what I assume will happen).
Within the IDE, when I deploy the web application (that is based on an AOP / AspectJ enabled dynamic web project in the IDE) and execute a method for which I know I've defined a pointcut in the above mentioned server level JAR (containing the aspects), the pointcut is not triggered.
I assume that the -javaagent switch might help, but when I try and add this to the server's VM arguments (on the window that's shown when I select the 'Open launch configuration' option from the IDE's Servew Overview panel), upon saving these arguments and re-opening the same window, the -javaagent option has been removed. In the Server Overview tab (under 'Server Locations'), the radio button is set to 'Use tc Server installation (takes control of tc Server installation)' but is greyed out (i.e. I cannot change it). I assume this is why the -javaagent argument is removed.
First, will the -javaagent option fix the problem? Second, how do I make it stick given that I cannot change the above mentioned radio button (I cannot find anywhere in the installation where the server's default VM arguments are set)?
Nov 5th, 2010, 05:43 PM
Figured it out...
Seems that by simply deploying a JAR file to the above mentioned lib directory with an aop.xml file in the META-INF directory did the trick. I already had this, but actually needed to declare the aspect in aop.xml (<aspects><aspect name="some.package.MyAspect"/></aspects>) in addition to having the original aspect .class file in the JAR, i.e...
public class MyAspect
Hope this helps someone else.
Tags for this Thread