[aspectwerkz-user] Re: Re: re[aspectwerkz-user] mote weaving?
neo anderson <[email protected]> Sun, 26 Oct 2008 06:24:25 -0700 (PDT)
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
After trying several times, I still can not get the online weaving worked. = I think there are several things I still do not understand very well.=20 Mainly it is 'What is the correct way (scenario) to execute the online weaving?'=20 From the document at http://aspectwerkz.codehaus.org/downloads/ saying that= , e.g. in transparent bootclasspath mode, running bin/aspectwerkz the first JVM will launch the application JVM. However, if I switch to run `$ASPECTWERKZ_HOME/bin/aspectwerkz -cp "./:target:$ASPECTWERKZ_HOME/lib/aspectwerkz-2.0.jar:$ASPECTWERKZ_HOME/lib/= aspectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-extensions-2.0.j= ar" action.Detector 1` The output will shows some extra information java ... -Xrunjdwp:transport=3Ddt_socket,suspend=3Dy,address=3D9300,server= =3Dy -Xdebug -Xbootclasspath/p ... ... Listening for transport dt_socket at address: 9300 Listening for transport dt_socket at address: 9300 AspectWerkz - INFO - Pre-processor org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor loaded and initialized Enable aspect! ... Deployer::INFO - deploying aspect [aspect.Observer] in class loader sun.misc.Launcher$AppClassLoader@17182c1] but still there is no aop information weaved to the running server.=20 Would you please to give me some advice or hints? (Sorry for this newbie question) Thanks again for the help. I appreciate it. Alexandre Vasseur wrote: >=20 > hot deployment MUST be in the same VM yes. Think deployment (of new aspec= t > but whose compiled code is already available) as a "runtime weaving" > Amex >=20 > On Sun, Oct 19, 2008 at 10:50 PM, neo anderson > <[email protected] >> wrote: >=20 >> >> >> I follow the example at >> >> http://blogs.codehaus.org/people/jboner/archives/000913_aspect_hot_deplo= yment_in_practice_implementing_a_jmx_monitoring_aspect_.html >> to do hot deployment, but it fails. There is no error returned to the >> screen. It only prints message like: >> >> Deployer::INFO - deploying aspect [aspect.Observer] in class loader >> sun.misc.Launcher$AppClassLoader@1a16869] >> >> The target application does not print out anything. >> >> The code to do deployment is >> >> package action; >> >> public class Detector{ >> >> ... >> void detect(){ >> System.out.println("Enable aspect! ..."); >> Deployer.deploy(Observer.class, toXML()); >> } >> ... >> private String toXML(){ >> return "<aspect class=3D\"Observer\"><pointcut >> name=3D\"count\" >> expression=3D\"execution(* sys.Server.count(..))\"/></aspect>"; >> /* //this xml throws not well formed xml definition exception >> return "<aspectwerkz>\n" + >> "<system id=3D\"Mock Server\">\n"+ >> " <package name=3D\"aspect\">\n"+ >> " <aspect class=3D\"Observer\">\n"+ >> " <pointcut name=3D\"count\= " >> expression=3D\"execution(* sys.Server.count(..))\"/>\n"+ >> " <advice >> name=3D\"beforeCount\" >> type=3D\"before\" bind-to=3D\"count\"/>\n"+ >> " <advice >> name=3D\"afterCount\" >> type=3D\"after\" bind-to=3D\"count\"/>\n"+ >> " </aspect>\n"+ >> " </package>\n"+ >> " </system>\n"+ >> "</aspectwerkz>\n"; >> */ >> } >> >> Where the Observer.java aspect and the application (Server.java) to be >> weaved is the same as >> http://www.nabble.com/Runtime-weaving-question-to20042123.html >> >> The way to test runtime weaving scenario is >> 1.) launch the server >> 2.) deploy the aspect by `java -cp >> >> "target:$ASPECTWERKZ_HOME/lib/aspectwerkz-2.0.jar:$ASPECTWERKZ_HOME/lib/= aspectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-extensions-2.0.j= ar" >> action.Detector 1` >> >> I also have a look at the example in jdk15/test folder, in which it seem= s >> like the hot deployment is done on the same jvm, e.g. >> >> public class HotDeployedTest ... >> public void testDeployment() { >> ... >> Deployer.deploy(HotdeployableAspect.class); >> target(); >> ... >> >> I think I have done something wrong, but do not know where it is. Would >> anyone please give me some hint or advice? >> >> Thank you very much, >> >> >> >> >> >> Jonas Bon=C3=A9r-3 wrote: >> > >> > Yes it is possible, but you will have to define a so-called >> > 'deployment scope' and preweave the classes (will just add tiny hooks, >> > but no aspects). Then you can do hot deploy and undeploy in a running >> > system. >> > Details here: >> > >> http://aspectwerkz.codehaus.org/new_features_in_2_0.html#Hot_deployment_= and_undeployment_of_aspects >> > >> > /Jonas >> > >> > On 10/3/07, Dongkwan Kim <[email protected]> wrote: >> >> Does AspectWerkz support the remote weaving? Let me explain my >> scenario >> >> in >> >> detail. >> >> Suppose there is a running Java application. It don't know >> AspectWerkz. >> I >> >> want to insert an aspect into the running application. This is called >> the >> >> remote weaving. Is there any way to weave already running Java >> classes? >> >> >> >> DK >> >> >> > >> > >> > -- >> > Jonas Bon=C3=A9r >> > >> > http://jonasboner.com >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/remote-weaving--tp13025650p20060099.html >> Sent from the AspectWerkz - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >=20 >> http://xircles.codehaus.org/manage_email >> >> >> >=20 >=20 --=20 View this message in context: http://www.nabble.com/remote-weaving--tp13025= 650p20173427.html Sent from the AspectWerkz - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email