[aspectwerkz-user] Re: Re: Re: re[aspectwerkz-user] mote weaving?
neo anderson <[email protected]> Mon, 27 Oct 2008 14:49:06 -0700 (PDT)
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
I think I am still confused with the term online weaving.=20
- How can I send aspect to the (targeted) running process (because hot
deployment required to run in the same JVM)?
- Do I need to startup the target application with socket opened?=20
Because when using -javaagent option, the terminal throws message=20
Error occurred during initialization of VM
agent library failed to init: instrument
failed to attach to VM (dt_socket, 9300):
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at
com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java=
:204)
at
com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnecto=
r.java:98)
at
com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.=
java:72)
at
org.codehaus.aspectwerkz.hook.ClassLoaderPatcher.hotswapClassLoader(ClassLo=
aderPatcher.java:205)
at
org.codehaus.aspectwerkz.hook.ProcessStarter.run(ProcessStarter.java:201)
at
org.codehaus.aspectwerkz.hook.ProcessStarter.main(ProcessStarter.java:271)
The way how I run the application is =20
1st, starting the target application by `java -classpath target sys.Server`
2nd, run the hot deployment `$ASPECTWERKZ_HOME/bin/aspectwerkz
-javaagent:$ASPECTWERKZ_HOME/lib/aspectwerkz-core-2.0.jar -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`
This looks incorrect, but I completely have no idea where goes wrong.=20
Would you please to give me advice?
I really appreciate your help.
Alexandre Vasseur wrote:
>=20
> please consider using the javaagent option. That is the best option to
> consider in Java 5 / java 6.
>=20
> On Sun, Oct 26, 2008 at 2:24 PM, neo anderson
> <[email protected]>wrote:
>=20
>>
>> 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 firs=
t
>> 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/l=
ib/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,serv=
er=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_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 b=
e
>> >> 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
>> 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=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:
>> >>
>> >
>> >> 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
>>
>>
>>
>=20
>=20
--=20
View this message in context: http://www.nabble.com/remote-weaving--tp13025=
650p20197173.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