Re: [aspectwerkz-user] Re: re[aspectwerkz-user] mote weaving?
"Alexandre Vasseur" <[email protected]> Tue, 21 Oct 2008 11:10:38 +0200
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_1153_33350014.1224580238448 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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]= k > 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\"co= unt\" > 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\"beforeCou= nt\" > type=3D\"before\" bind-to=3D\"count\"/>\n"+ > " <advice name=3D\"afterCoun= t\" > 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. Would > 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 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_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 scenari= o > >> 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=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 > > > ------=_Part_1153_33350014.1224580238448 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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&qu= ot;<br>Amex<br><br><div class=3D"gmail_quote">On Sun, Oct 19, 2008 at 10:50= PM, neo anderson <span dir=3D"ltr"><<a href=3D"mailto:javadeveloper999@= yahoo.co.uk">[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> <br> I follow the example at<br> <a href=3D"http://blogs.codehaus.org/people/jboner/archives/000913_aspect_h= ot_deployment_in_practice_implementing_a_jmx_monitoring_aspect_.html" targe= t=3D"_blank">http://blogs.codehaus.org/people/jboner/archives/000913_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 loader<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.deploy(Obs= erver.class, toXML());<br> }<br> ...<br> private String toXML(){<br> return "<as= pect class=3D\"Observer\"><pointcut name=3D\"count\&qu= ot;<br> expression=3D\"execution(* sys.Server.count(..))\"/></aspec= t>";<br> /* //this xml throws not well formed xml definition exception<br> return "<as= pectwerkz>\n" +<br> &nbs= p; "<system id=3D\"Mock Server\">\n"+<br> &nbs= p; " <package name=3D\"aspect\"= ;>\n"+<br> &nbs= p; " <aspect= class=3D\"Observer\">\n"+<br> &nbs= p; " &nb= sp; <pointcut name=3D\"count\"<br> expression=3D\"execution(* sys.Server.count(..))\"/>\n"+<= br> &nbs= p; " &nb= sp; <advice name=3D\"beforeCount\"<br> type=3D\"before\" bind-to=3D\"count\"/>\n"+<br> &nbs= p; " &nb= sp; <advice name=3D\"afterCount\"<br> type=3D\"after\" bind-to=3D\"count\"/>\n"+<br> &nbs= p; " </aspec= t>\n"+<br> &nbs= p; " </package>\n"+<br> &nbs= p; " </system>\n"+<br> &nbs= p; "</aspectwerkz>\n";<br> */<br> }<br> <br> Where the Observer.java aspect and the application (Server.java) to be<br> weaved is the same as<br> <a href=3D"http://www.nabble.com/Runtime-weaving-question-to20042123.html" = target=3D"_blank">http://www.nabble.com/Runtime-weaving-question-to20042123= .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> "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"<br> action.Detector 1`<br> <br> I also have a look at the example in jdk15/test folder, in which it seems<b= r> 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<br> > 'deployment scope' and preweave the classes (will just add tin= y hooks,<br> > but no aspects). Then you can do hot deploy and undeploy in a running<= br> > system.<br> > Details here:<br> > <a href=3D"http://aspectwerkz.codehaus.org/new_features_in_2_0.html#Ho= t_deployment_and_undeployment_of_aspects" target=3D"_blank">http://aspectwe= rkz.codehaus.org/new_features_in_2_0.html#Hot_deployment_and_undeployment_o= f_aspects</a><br> ><br> > /Jonas<br> ><br> > On 10/3/07, Dongkwan Kim <<a href=3D"mailto:[email protected]">v= [email protected]</a>> wrote:<br> >> Does AspectWerkz support the remote weaving? Let me explain my sce= nario<br> >> in<br> >> detail.<br> >> Suppose there is a running Java application. It don't know Asp= ectWerkz. I<br> >> want to insert an aspect into the running application. This is cal= led the<br> >> remote weaving. Is there any way to weave already running Java cla= sses?<br> >><br> >> DK<br> >><br> ><br> ><br> > --<br> > Jonas Bon=E9r<br> ><br> > <a href=3D"http://jonasboner.com" target=3D"_blank">http://jonasboner.= com</a><br> ><br> ><br> <br> --<br> View this message in context: <a href=3D"http://www.nabble.com/remote-weavi= ng--tp13025650p20060099.html" target=3D"_blank">http://www.nabble.com/remot= e-weaving--tp13025650p20060099.html</a><br> Sent from the AspectWerkz - User 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> </blockquote></div><br> ------=_Part_1153_33350014.1224580238448--