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">&lt;<a href=3D"mailto:javad=
[email protected]">[email protected]</a>&gt;</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 &#39;What is the correct way (scenario) to execute the online<=
br>
weaving?&#39;<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 &nbsp;will launch the application JVM. However, if I switch to run<br>
`$ASPECTWERKZ_HOME/bin/aspectwerkz -cp<br>
<div class=3D"Ih2E3d">&quot;./: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&quot;<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>
&gt;<br>
&gt; hot deployment MUST be in the same VM yes. Think deployment (of new as=
pect<br>
&gt; but whose compiled code is already available) as a &quot;runtime weavi=
ng&quot;<br>
&gt; Amex<br>
&gt;<br>
&gt; On Sun, Oct 19, 2008 at 10:50 PM, neo anderson<br>
&gt; &lt;<a href=3D"mailto:[email protected]">javadeveloper999@y=
ahoo.co.uk</a><br>
&gt;&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I follow the example at<br>
&gt;&gt;<br>
&gt;&gt; <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>

&gt;&gt; to do hot deployment, but it fails. There is no error returned to =
the<br>
&gt;&gt; screen. It only prints message like:<br>
&gt;&gt;<br>
&gt;&gt; Deployer::INFO - deploying aspect [aspect.Observer] in class loade=
r<br>
&gt;&gt; sun.misc.Launcher$AppClassLoader@1a16869]<br>
&gt;&gt;<br>
&gt;&gt; The target application does not print out anything.<br>
&gt;&gt;<br>
&gt;&gt; The code to do deployment is<br>
&gt;&gt;<br>
&gt;&gt; package action;<br>
&gt;&gt;<br>
&gt;&gt; public class Detector{<br>
&gt;&gt;<br>
&gt;&gt; ...<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;void detect(){<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.=
println(&quot;Enable aspect! ...&quot;);<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Deployer.de=
ploy(Observer.class, toXML());<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt;&gt; ...<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;private String toXML(){<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return &quo=
t;&lt;aspect class=3D\&quot;Observer\&quot;&gt;&lt;pointcut<br>
&gt;&gt; name=3D\&quot;count\&quot;<br>
&gt;&gt; expression=3D\&quot;execution(* sys.Server.count(..))\&quot;/&gt;&=
lt;/aspect&gt;&quot;;<br>
&gt;&gt; /* //this xml throws not well formed xml definition exception<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return &quo=
t;&lt;aspectwerkz&gt;\n&quot; +<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot;&lt;system id=3D\&quot;Mock Server\&quot;&gt;\n&quot=
;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &lt;package name=3D\&quot;aspe=
ct\&quot;&gt;\n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &l=
t;aspect class=3D\&quot;Observer\&quot;&gt;\n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; &nbsp; &lt;pointcut name=3D\&quot;count\&quot;<br>
&gt;&gt; expression=3D\&quot;execution(* sys.Server.count(..))\&quot;/&gt;\=
n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; &nbsp; &lt;advice<br>
&gt;&gt; name=3D\&quot;beforeCount\&quot;<br>
&gt;&gt; type=3D\&quot;before\&quot; bind-to=3D\&quot;count\&quot;/&gt;\n&q=
uot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; &nbsp; &lt;advice<br>
&gt;&gt; name=3D\&quot;afterCount\&quot;<br>
&gt;&gt; type=3D\&quot;after\&quot; bind-to=3D\&quot;count\&quot;/&gt;\n&qu=
ot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &l=
t;/aspect&gt;\n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &lt;/package&gt;\n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot; &nbsp; &nbsp; &nbsp; &lt;/system&gt;\n&quot;+<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;&quot;&lt;/aspectwerkz&gt;\n&quot;;<br>
&gt;&gt; */<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt;&gt;<br>
&gt;&gt; Where the Observer.java aspect and the application (Server.java) t=
o be<br>
&gt;&gt; weaved is the same as<br>
&gt;&gt; <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>
&gt;&gt;<br>
&gt;&gt; The way to test runtime weaving scenario is<br>
&gt;&gt; 1.) launch the server<br>
&gt;&gt; 2.) deploy the aspect by `java -cp<br>
&gt;&gt;<br>
&gt;&gt; &quot;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&quot;<br>
&gt;&gt; action.Detector 1`<br>
&gt;&gt;<br>
&gt;&gt; I also have a look at the example in jdk15/test folder, in which i=
t seems<br>
&gt;&gt; like the hot deployment is done on the same jvm, e.g.<br>
&gt;&gt;<br>
&gt;&gt; public class HotDeployedTest ...<br>
&gt;&gt; &nbsp; public void testDeployment() {<br>
&gt;&gt; ...<br>
&gt;&gt; &nbsp; &nbsp; Deployer.deploy(HotdeployableAspect.class);<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;target();<br>
&gt;&gt; ...<br>
&gt;&gt;<br>
&gt;&gt; I think I have done something wrong, but do not know where it is. =
Would<br>
&gt;&gt; anyone please give me some hint or advice?<br>
&gt;&gt;<br>
&gt;&gt; Thank you very much,<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Jonas Bon=E9r-3 wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Yes it is possible, but you will have to define a so-called<b=
r>
&gt;&gt; &gt; &#39;deployment scope&#39; and preweave the classes (will jus=
t add tiny hooks,<br>
&gt;&gt; &gt; but no aspects). Then you can do hot deploy and undeploy in a=
 running<br>
&gt;&gt; &gt; system.<br>
&gt;&gt; &gt; Details here:<br>
&gt;&gt; &gt;<br>
&gt;&gt; <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>

&gt;&gt; &gt;<br>
&gt;&gt; &gt; /Jonas<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On 10/3/07, Dongkwan Kim &lt;<a href=3D"mailto:vtdongkwan@gma=
il.com">[email protected]</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; Does AspectWerkz support the remote weaving? Let me expla=
in my<br>
&gt;&gt; scenario<br>
&gt;&gt; &gt;&gt; in<br>
&gt;&gt; &gt;&gt; detail.<br>
&gt;&gt; &gt;&gt; Suppose there is a running Java application. It don&#39;t=
 know<br>
&gt;&gt; AspectWerkz.<br>
&gt;&gt; I<br>
&gt;&gt; &gt;&gt; want to insert an aspect into the running application. Th=
is is called<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; remote weaving. Is there any way to weave already running=
 Java<br>
&gt;&gt; classes?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; DK<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Jonas Bon=E9r<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; <a href=3D"http://jonasboner.com" target=3D"_blank">http://jo=
nasboner.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <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>
&gt;&gt; Sent from the AspectWerkz - User mailing list archive at Nabble.co=
m.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ------------------------------------------------------------------=
---<br>
&gt;&gt; To unsubscribe from this list, please visit:<br>
&gt;&gt;<br>
&gt;<br>
&gt;&gt; &nbsp; &nbsp;<a href=3D"http://xircles.codehaus.org/manage_email" =
target=3D"_blank">http://xircles.codehaus.org/manage_email</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<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>
 &nbsp; &nbsp;<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--