aboutsummaryrefslogtreecommitdiffstats
path: root/docs/sandbox/trails/j2ee.txt
blob: 8685939b1653297507df114c6b58e32f2910a858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
This contains short notes on using AspectJ with various J2EE
servers and deployment tools.

// @author Wes Isberg

-------- START-SAMPLE j2ee-servlets-generally Using AspectJ in servlets
AspectJ programs work if run in the same namespace and with aspectjrt.jar.
Servlet runners and J2EE web containers should run AspectJ programs fine
if the classes and required libraries are deployed as usual.  The runtime
classes and shared aspects might need to be deployed into a common 
directory to work properly across applications, especially in containers 
that use different class loaders for different applications or use 
different class-loading schemes.

As with any shared library, if more than one application is using AspectJ, 
then the aspectjrt.jar should be deployed where it will be loaded by a 
common classloader. 

Aspects which are used by two applications might be independent or shared.
Independent aspects can be deployed in each application-specific archive.
Aspects might be shared explicitly or implicitly, as when they are stateful 
or staticly bound (however indirectly) to common classes.  When in doubt,
it is safest to deploy the aspects in the common namespace.

-------- END-SAMPLE j2ee-servlets-generally

-------- START-SAMPLE j2ee-servlets-tomcat4 Running AspectJ servlets in Tomcat 4.x
To deploy an AspectJ program as a Tomcat servlet,
place aspectjrt.jar in shared/lib and deploy the required libraries
and AspectJ-compiled servlet classes as usual.

-------- END-SAMPLE j2ee-servlets-tomcat4