Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Load time weaving for AspectJ 5 on Java 1.3/1.4

Mike and all (I know Ron will be interested)

I have described how to enable load time weaving for AspectJ 5 with a
non JRockit, non Java 5 VM ie Java 1.3 and 1.4 under Sun JVM.
This requires some plumbing as you 'll figure there, but I hope this
can help you. The sample there contains a small application with an
Ant script that describes pretty much everything and illustrates how
AspectJ 5 is used for a 100% Java 1.3 application both for the aspects
(written using javadoc annotation for AspectJ 5) and for the load time
weaving.

http://blogs.codehaus.org/people/avasseur/archives/001140_aspectj_5_load_time_weaving_with_java_13_using_aspectwerkz.html

Note that you will need a recent AspectJ for it and a bunch of other
pieces as described in the post.

Alex


On 7/28/05, Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:
>  
>  
> 
> Hi Mike, 
> 
>   
> 
> What you are asking for is support for load-time weaving with the Sun Java
> 1.4 VM (since JRockIt 1.4 is Java 1.4, but the Sun VM is more common). I
> would also like to have support for 1.3 and 1.4 Sun VM's. Alex and Jonas
> have developed this type of support in past with AspectWerkz, so it's good
> for them to hear interest from other users. For Sun 1.3 and 1.4 VM's, I
> believe there are three ways that this kind of load-time weaving has been
> achieved in past: 
> 
>   
> 
> 1)       With a script that patches java.lang.ClassLoader to add hooks and
> puts it in on the bootclasspath 
> 
> 2)       By running in debug mode to hotswap the bootclasspath classloader
> definition (for Java 1.4) 
> 
> 3)       Take advantage of application server classloader hooks, e.g.,
> ClassPreProcessor for WebLogic 6 and later. 
> 
>   
> 
> The third strategy is probably the best one if you are looking for load-time
> weaving of applications inside a container that has an API, but it's not
> general purpose. Those considering using the first one should look at their
> license agreement for Sun's Java VM carefully. The second option is not one
> that I think is very practical for production use; I wouldn't recommend
> running a VM in debug mode. 
> 
>   
> 
> Hopefully the experts on this can explain the options in more depth. I'd
> love to see this kind of support in AspectJ 1.5.0 final or at least shortly
> afterwards. 
> 
>   
>  
>  ________________________________
>  
> 
> From: aspectj-dev-bounces@xxxxxxxxxxx
> [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Mike Haladin
>  Sent: Thursday, July 28, 2005 4:52 AM
>  To: aspectj-dev@xxxxxxxxxxx
> 
>  Subject: Re: [aspectj-dev] java 1.4 and M3 
>  
> 
>   
> 
> Hi Alex,
>  
>      Thanks for your reply.  My project does not use JRockit either.  Is
> there a way to take advantage of some of this functionality in Java 1.4?
>  
>  thanks,
>  Mike
>  
>  
>  Message: 8
>  Date: Thu, 28 Jul 2005 13:30:49 +0200
>  From: Alexandre Vasseur <avasseur@xxxxxxxxx>
>  Subject: Re: [aspectj-dev] java 1.4 and M3
>  To: AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>
>  Message-ID: <9aface8705072804304b00f792@xxxxxxxxxxxxxx>
>  Content-Type: text/plain; charset=ISO-8859-1
>  
>  Hi Mike
>  
>  There is support for that thru a JRockit agent that thus provide this
>  feature under java 1.3 and 1.4. It will be part of M3 and will appear
>  in the documentation as well.
>  This will be something like:
>  jrockit/java
> -Xmanagement:class==org.aspectj.weaver.loadtime.JRockitAgent
>   -cp ...
>  (for Java 1.3 you may need to add a xerces or whatever SAX xml engine
>  as well in the classpath).
>  
>  As per weaving MBeans, Ron Bodkin has reported some bugs recently
>  about that but that is also assumed to work.
>  
>  Alex
>  
>  
>  On 7/28/05, Mike Haladin <mike.haladin@xxxxxx> wrote:
>  >  Hello Alex,
>  >  
>  >      You mentioned that there would be a JVM option that turns on weaving
> on
>  > a JVM wide basis in M3.  This would resolve the problem of having to know
>  > all jars to be woven at runtime.  
>  >  
>  >      You also mentioned that there would be an option that would let me
>  > weave into MBeans as well.
>  >  
>  >      Can you tell me if these options are in M3 and if they are available
>  > for Java 1.4? 
>  >  
>  >      If they are not directly available for 1.4, is there a workaround
> for
>  > 1.4?
>  >  
>  >      My project will not go to java 1.5 until the next release (next
> year).
>  >  
>  >  thanks,
>  >  Mike
>  >  
>  >  -- 
>  > 
>  >  
>  > _______________________________________________
>  > aspectj-dev mailing list
>  > aspectj-dev@xxxxxxxxxxx
>  > https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>  > 
>   
> -- 
>  
> 
>   
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 
> 
>


Back to the top