Announcement Announcement Module
Collapse
No announcement yet.
LTW without need for javaagent? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LTW without need for javaagent?

    So I've been poking around the new Spring 2.0 stuff.

    I'm in a shared environment and I'd very much like to use the full power of @AspectJ but I can't change the jvm startup parameters so that it uses the aspectweaver.jar as the classloader/javaagent.

    Been seeing things around the new JPA stuff that makes it sound like it might be possible to do this sort of thing without the need to change the JVM arguments.

    Is this remotely true or am I off my rocker?

    Andy O

  • #2
    You can just compile your code using 'ajc' (the AspectJ compiler). Then you won't need to modify the JVM parameters.

    -Ramnivas

    Comment


    • #3
      Yes but that's not what I'm looking for. I know there are solutions to enable aspects through a variety of mechanisms. I'm specifically interested in LTW.

      Comment


      • #4
        Here are your three options

        If you want to use the full power of the @AspectJ syntax (i.e. crosscut any object, and not just beans exposed at the configuration level), you have three options:
        1. Use compile-time weaving, where source files form input to the compiler.
        2. Use binary weaving, where class/jar files form input to the compiler (which works more like a linker). An advantage of this option is that you can compile your classes and aspects using 'javac' and then execute 'ajc' over those classes to weave them all together. In effect, you only augment your current build system with a post-compile task.
        3. Use the load-time weaver, using the -javaagent option in Java 5 (or a similar option in JRockit 1.4+) or using a special classloader.

        The bottom line is that the AspectJ weaver needs to be introduced somewhere between you writing source code to the VM loading the classes.

        -Ramnivas

        Comment


        • #5
          Right. I understand those options.

          My question is, is it possible to do #3 (LTW) without putting the javaagent argument on the command line? I know it's not possible out of the box w/ AspectJ, but I've been reading things about shadow classloaders and stuff with respect to JPA. I am curious if Spring has any mechanisms that could facilitate that (LTW/Option 3 w/o changing the arguments on the command line of the JVM).

          Andy O

          Comment


          • #6
            Hi Andy!

            Did you find a solution for this?
            I'd be interested as well!
            For all I've read, the Spring LTW infrastructure should provide what we're looking for, but I couldn't find any useful documentation or working examples for it!
            Let me know when you get any further on this...

            Best regards,
            Florian

            Comment


            • #7
              Originally posted by kflorian View Post
              Hi Andy!

              Did you find a solution for this?
              I'd be interested as well!
              For all I've read, the Spring LTW infrastructure should provide what we're looking for, but I couldn't find any useful documentation or working examples for it!
              Let me know when you get any further on this...

              Best regards,
              Florian
              If you are interested in it, vote for following JIRA-issue
              http://opensource.atlassian.com/proj...rowse/SPR-2492

              Comment

              Working...
              X