Re: [aspectwerkz-user] Re: Re: re[aspectwerkz-user] mote weaving?
"Alexandre Vasseur" <[email protected]> Sun, 26 Oct 2008 20:08:48 +0100
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_35193_7845649.1225048128416 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline please consider using the javaagent option. That is the best option to consider in Java 5 / java 6. On Sun, Oct 26, 2008 at 2:24 PM, neo anderson <[email protected]>wrote: > > 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. > > Mainly it is 'What is the correct way (scenario) to execute the online > weaving?' > > 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/li= b/aspectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-extensions-2.0= .jar" > action.Detector 1` > > The output will shows some extra information > > java ... -Xrunjdwp:transport=3Ddt_socket,suspend=3Dy,address=3D9300,serve= r=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. > > 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: > > > > hot deployment MUST be in the same VM yes. Think deployment (of new > aspect > > but whose compiled code is already available) as a "runtime weaving" > > Amex > > > > On Sun, Oct 19, 2008 at 10:50 PM, neo anderson > > <[email protected] > >> wrote: > > > >> > >> > >> I follow the example at > >> > >> > http://blogs.codehaus.org/people/jboner/archives/000913_aspect_hot_deploy= ment_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\"coun= t\" > >> 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/a= spectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-extensions-2.0.ja= r" > >> action.Detector 1` > >> > >> I also have a look at the example in jdk15/test folder, in which it > seems > >> 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. Woul= d > >> anyone please give me some hint or advice? > >> > >> Thank you very much, > >> > >> > >> > >> > >> > >> Jonas Bon=E9r-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 hook= s, > >> > but no aspects). Then you can do hot deploy and undeploy in a runnin= g > >> > system. > >> > Details here: > >> > > >> > http://aspectwerkz.codehaus.org/new_features_in_2_0.html#Hot_deployment_a= nd_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 call= ed > >> the > >> >> remote weaving. Is there any way to weave already running Java > >> classes? > >> >> > >> >> DK > >> >> > >> > > >> > > >> > -- > >> > Jonas Bon=E9r > >> > > >> > 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: > >> > > > >> http://xircles.codehaus.org/manage_email > >> > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/remote-weaving--tp13025650p20173427.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 > > > ------=_Part_35193_7845649.1225048128416 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline please consider using the javaagent option. That is the best option to cons= ider in Java 5 / java 6.<br><br><div class=3D"gmail_quote">On Sun, Oct 26, = 2008 at 2:24 PM, neo anderson <span dir=3D"ltr"><<a href=3D"mailto:javad= [email protected]">[email protected]</a>></span> wrote:= <br> <blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, = 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> After trying several times, I still can not get the online weaving worked. = I<br> think there are several things I still do not understand very well.<br> <br> Mainly it is 'What is the correct way (scenario) to execute the online<= br> weaving?'<br> <br> From the document at <a href=3D"http://aspectwerkz.codehaus.org/downloads/"= target=3D"_blank">http://aspectwerkz.codehaus.org/downloads/</a> saying th= at,<br> e.g. in transparent bootclasspath mode, running bin/aspectwerkz the first<b= r> JVM will launch the application JVM. However, if I switch to run<br> `$ASPECTWERKZ_HOME/bin/aspectwerkz -cp<br> <div class=3D"Ih2E3d">"./:target:$ASPECTWERKZ_HOME/lib/aspectwerkz-2.0= .jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/a= spectwerkz-extensions-2.0.jar"<br> action.Detector 1`<br> <br> </div>The output will shows some extra information<br> <br> java ... -Xrunjdwp:transport=3Ddt_socket,suspend=3Dy,address=3D9300,server= =3Dy<br> -Xdebug -Xbootclasspath/p ...<br> ...<br> Listening for transport dt_socket at address: 9300<br> Listening for transport dt_socket at address: 9300<br> AspectWerkz - INFO - Pre-processor<br> org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor loaded and<br> initialized<br> Enable aspect! ...<br> <div class=3D"Ih2E3d">Deployer::INFO - deploying aspect [aspect.Observer] i= n class loader<br> </div>sun.misc.Launcher$AppClassLoader@17182c1]<br> <br> but still there is no aop information weaved to the running server.<br> <br> Would you please to give me some advice or hints? (Sorry for this newbie<br= > question)<br> <br> Thanks again for the help. I appreciate it.<br> <div><div></div><div class=3D"Wj3C7c"><br> <br> Alexandre Vasseur wrote:<br> ><br> > hot deployment MUST be in the same VM yes. Think deployment (of new as= pect<br> > but whose compiled code is already available) as a "runtime weavi= ng"<br> > Amex<br> ><br> > On Sun, Oct 19, 2008 at 10:50 PM, neo anderson<br> > <<a href=3D"mailto:[email protected]">javadeveloper999@y= ahoo.co.uk</a><br> >> wrote:<br> ><br> >><br> >><br> >> I follow the example at<br> >><br> >> <a href=3D"http://blogs.codehaus.org/people/jboner/archives/000913= _aspect_hot_deployment_in_practice_implementing_a_jmx_monitoring_aspect_.ht= ml" target=3D"_blank">http://blogs.codehaus.org/people/jboner/archives/0009= 13_aspect_hot_deployment_in_practice_implementing_a_jmx_monitoring_aspect_.= html</a><br> >> to do hot deployment, but it fails. There is no error returned to = the<br> >> screen. It only prints message like:<br> >><br> >> Deployer::INFO - deploying aspect [aspect.Observer] in class loade= r<br> >> sun.misc.Launcher$AppClassLoader@1a16869]<br> >><br> >> The target application does not print out anything.<br> >><br> >> The code to do deployment is<br> >><br> >> package action;<br> >><br> >> public class Detector{<br> >><br> >> ...<br> >> void detect(){<br> >> System.out.= println("Enable aspect! ...");<br> >> Deployer.de= ploy(Observer.class, toXML());<br> >> }<br> >> ...<br> >> private String toXML(){<br> >> return &quo= t;<aspect class=3D\"Observer\"><pointcut<br> >> name=3D\"count\"<br> >> expression=3D\"execution(* sys.Server.count(..))\"/>&= lt;/aspect>";<br> >> /* //this xml throws not well formed xml definition exception<br> >> return &quo= t;<aspectwerkz>\n" +<br> >> &nb= sp; "<system id=3D\"Mock Server\">\n"= ;+<br> >> &nb= sp; " <package name=3D\"aspe= ct\">\n"+<br> >> &nb= sp; " &l= t;aspect class=3D\"Observer\">\n"+<br> >> &nb= sp; " &n= bsp; <pointcut name=3D\"count\"<br> >> expression=3D\"execution(* sys.Server.count(..))\"/>\= n"+<br> >> &nb= sp; " &n= bsp; <advice<br> >> name=3D\"beforeCount\"<br> >> type=3D\"before\" bind-to=3D\"count\"/>\n&q= uot;+<br> >> &nb= sp; " &n= bsp; <advice<br> >> name=3D\"afterCount\"<br> >> type=3D\"after\" bind-to=3D\"count\"/>\n&qu= ot;+<br> >> &nb= sp; " &l= t;/aspect>\n"+<br> >> &nb= sp; " </package>\n"+<br> >> &nb= sp; " </system>\n"+<br> >> &nb= sp; "</aspectwerkz>\n";<br> >> */<br> >> }<br> >><br> >> Where the Observer.java aspect and the application (Server.java) t= o be<br> >> weaved is the same as<br> >> <a href=3D"http://www.nabble.com/Runtime-weaving-question-to200421= 23.html" target=3D"_blank">http://www.nabble.com/Runtime-weaving-question-t= o20042123.html</a><br> >><br> >> The way to test runtime weaving scenario is<br> >> 1.) launch the server<br> >> 2.) deploy the aspect by `java -cp<br> >><br> >> "target:$ASPECTWERKZ_HOME/lib/aspectwerkz-2.0.jar:$ASPECTWERK= Z_HOME/lib/aspectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-exten= sions-2.0.jar"<br> >> action.Detector 1`<br> >><br> >> I also have a look at the example in jdk15/test folder, in which i= t seems<br> >> like the hot deployment is done on the same jvm, e.g.<br> >><br> >> public class HotDeployedTest ...<br> >> public void testDeployment() {<br> >> ...<br> >> Deployer.deploy(HotdeployableAspect.class);<br> >> target();<br> >> ...<br> >><br> >> I think I have done something wrong, but do not know where it is. = Would<br> >> anyone please give me some hint or advice?<br> >><br> >> Thank you very much,<br> >><br> >><br> >><br> >><br> >><br> >> Jonas Bon=E9r-3 wrote:<br> >> ><br> >> > Yes it is possible, but you will have to define a so-called<b= r> >> > 'deployment scope' and preweave the classes (will jus= t add tiny hooks,<br> >> > but no aspects). Then you can do hot deploy and undeploy in a= running<br> >> > system.<br> >> > Details here:<br> >> ><br> >> <a href=3D"http://aspectwerkz.codehaus.org/new_features_in_2_0.htm= l#Hot_deployment_and_undeployment_of_aspects" target=3D"_blank">http://aspe= ctwerkz.codehaus.org/new_features_in_2_0.html#Hot_deployment_and_undeployme= nt_of_aspects</a><br> >> ><br> >> > /Jonas<br> >> ><br> >> > On 10/3/07, Dongkwan Kim <<a href=3D"mailto:vtdongkwan@gma= il.com">[email protected]</a>> wrote:<br> >> >> Does AspectWerkz support the remote weaving? Let me expla= in my<br> >> scenario<br> >> >> in<br> >> >> detail.<br> >> >> Suppose there is a running Java application. It don't= know<br> >> AspectWerkz.<br> >> I<br> >> >> want to insert an aspect into the running application. Th= is is called<br> >> the<br> >> >> remote weaving. Is there any way to weave already running= Java<br> >> classes?<br> >> >><br> >> >> DK<br> >> >><br> >> ><br> >> ><br> >> > --<br> >> > Jonas Bon=E9r<br> >> ><br> >> > <a href=3D"http://jonasboner.com" target=3D"_blank">http://jo= nasboner.com</a><br> >> ><br> >> ><br> >><br> >> --<br> >> View this message in context:<br> >> <a href=3D"http://www.nabble.com/remote-weaving--tp13025650p200600= 99.html" target=3D"_blank">http://www.nabble.com/remote-weaving--tp13025650= p20060099.html</a><br> >> Sent from the AspectWerkz - User mailing list archive at Nabble.co= m.<br> >><br> >><br> >> ------------------------------------------------------------------= ---<br> >> To unsubscribe from this list, please visit:<br> >><br> ><br> >> <a href=3D"http://xircles.codehaus.org/manage_email" = target=3D"_blank">http://xircles.codehaus.org/manage_email</a><br> >><br> >><br> >><br> ><br> ><br> <br> </div></div><font color=3D"#888888">--<br> View this message in context: <a href=3D"http://www.nabble.com/remote-weavi= ng--tp13025650p20173427.html" target=3D"_blank">http://www.nabble.com/remot= e-weaving--tp13025650p20173427.html</a><br> </font><div><div></div><div class=3D"Wj3C7c">Sent from the AspectWerkz - Us= er mailing list archive at Nabble.com.<br> <br> <br> ---------------------------------------------------------------------<br> To unsubscribe from this list, please visit:<br> <br> <a href=3D"http://xircles.codehaus.org/manage_email" target= =3D"_blank">http://xircles.codehaus.org/manage_email</a><br> <br> <br> </div></div></blockquote></div><br> ------=_Part_35193_7845649.1225048128416--