[aspectwerkz-user] Re: re[aspectwerkz-user] mote weaving?
neo anderson <[email protected]> Sun, 19 Oct 2008 13:50:47 -0700 (PDT)
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
I follow the example at
http://blogs.codehaus.org/people/jboner/archives/000913_aspect_hot_deployme=
nt_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\"cou=
nt\"
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\"beforeCoun=
t\"
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";=20
*/
}
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=20
1.) launch the server
2.) deploy the aspect by `java -cp
"target:$ASPECTWERKZ_HOME/lib/aspectwerkz-2.0.jar:$ASPECTWERKZ_HOME/lib/asp=
ectwerkz-core-2.0.jar:$ASPECTWERKZ_HOME/lib/aspectwerkz-extensions-2.0.jar"
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.=20
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:
>=20
> 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
>=20
> /Jonas
>=20
> 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 th=
e
>> remote weaving. Is there any way to weave already running Java classes?
>>
>> DK
>>
>=20
>=20
> --=20
> Jonas Bon=C3=A9r
>=20
> http://jonasboner.com
>=20
>=20
--=20
View this message in context: http://www.nabble.com/remote-weaving--tp13025=
650p20060099.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