Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Load-time weaving with Eclipse RCP application

Hi Stephan

As I expected, this is a side effect of the underlying OSGi
architecture, and the way you package the aspect.

Try packaging the aspect and the aop.xml in the
plugins/rcpdemo_1.0.0.jar itself so that you have something like :
plugins/rcpdemo_1.0.0.jar/META-INF/aop.xml
plugins/rcpdemo_1.0.0.jar/util/..... your aspect
plugins/rcpdemo_1.0.0.jar/rcpdemo/.... the rcpdemo app as it is

Then run with the same command line.
You will see more traces, and you will actually even see a class not
found error issued by the weaver on "org.aspectj.lang.JoinPoint" when
a rcpdemo class is beeing advised.
All that is due to the way OSGi enforce classloading with
requires/export declarations in the bundle Manifest I think.
Dropping a jar in the supposed classpath is in no way enough in the
OSGi world - as far as I know it.

That be interesting to see how you manage to properly package the
tracing aspect outside of the app itself. You may know more than me
about the OSGi things and the way things need to be packaged /
declared to require/import/export.

Alex

On 7/6/05, Stephan Kolp <stephan.kolp@xxxxxxxxxx> wrote:
> Thanks for testing but I don't think that the problem is solved.
> 
> I suppose you didn't mail the whole output. I get this too, but as soon
> as the launcher starts the EclipseStarter, it seems that no more
> matching joinpoints will be found. The last output I get is
> 
> before: call(Class java.net.URLClassLoader.loadClass(String))
> arg0(class java.lang.String)=
> org.eclipse.core.runtime.adaptor.EclipseStarter
> WeavingAdaptor.weaveClass org/eclipse/core/runtime/adaptor/EclipseStarter
> before: call(Class java.lang.Class.forName(String))
> arg0(class java.lang.String)= [Ljava.lang.String;
> before: call(Class java.lang.Class.forName(String))
> arg0(class java.lang.String)= java.lang.Runnable
> 
> At least the call of the method start method of RCPDEMO should be announced.
> 
> I'm interested in information that my aspect gets from my own classes in
> the package rcpdemo. But if I edit the aop.xml and set <include
> within="rcpdemo.*"/> I get no aspect output.
> 
> Regards, Stephan
> 
> Alexandre Vasseur schrieb:
> > Thanks Stephan for sending me the demo app.
> >
> > I started it using the current AspectJ build aspectjweaver.jar (I
> > don't know which one you are using, but I haven't done any specific
> > fix for this to work recently)  and java5, with:
> >
> > set MCLASSPATH=loglib.jar;startup.jar;.
> >
> > java -javaagent:%AJH%\aspectjweaver.jar -cp %MCLASSPATH%
> > org.eclipse.core.launcher.Main
> >
> >
> > and I get :
> > (just add -verbose -showWeaveInfo in the weaver option in aop.xml)
> >
> > arg0(class java.lang.String)= osgi.configuration.area
> > before: call(String java.lang.System.getProperty(String))
> > arg0(class java.lang.String)= osgi.baseConfiguration.area
> > before: call(String java.lang.System.getProperty(String))
> > arg0(class java.lang.String)= osgi.install.area
> > before: call(Class java.lang.Class.forName(String))
> > arg0(class java.lang.String)= org.eclipse.core.launcher.Main
> > before: call(String org.eclipse.core.launcher.Main.decode(String))
> > arg0(class java.lang.String)= /C:/Documents%20and%20Settings/avasseur/Bureau/RCP
> > demo/RCPDEMO1/eclipse/startup.jar
> > before: call(Class java.lang.Class.forName(String))
> > arg0(class java.lang.String)= java.net.URLDecoder
> > before: call(Class java.lang.Class.forName(String))
> > arg0(class java.lang.String)= java.lang.String
> > before: call(int java.lang.String.indexOf(int))
> > arg0(class java.lang.Integer)= 43
> > before: call(char java.lang.String.charAt(int))
> > arg0(class java.lang.Integer)= 0
> > before: call(boolean java.lang.Character.isUpperCase(char))
> > arg0(class java.lang.Character)= C
> > before: call(char java.lang.Character.toLowerCase(char))
> >
> > I can't get it to run with rcpdemo.exe and -vmargs though - don't know
> > what's going on there (keeps failing complaining that the aspect from
> > aop.xml cannot be found ie is not in the classpath)
> >
> > Alex
> >
> > On 7/4/05, Stephan Kolp <stephan.kolp@xxxxxxxxxx> wrote:
> >
> >>Hello,
> >>
> >>The exact command line is
> >>
> >>     java -javaagent:%ASPECTJ_HOME%\lib\aspectjweaver.jar
> >>          org.eclipse.core.launcher.Main
> >>
> >>I use it from my product's directory which contains the META-INF
> >>directory with aop.xml
> >>
> >>ASPECTJ_HOME=C:\Programme\_develop\AspectJ
> >>CLASSPATH=C:\temp\RCPDEMO\eclipse\loglib.jar;
> >>     C:\temp\RCPDEMO\eclipse\startup.jar;
> >>     C:\Programme\_develop\AspectJ\lib\aspectjrt.jar;.
> >>
> >>loglib.jar contains my aspect and startup.jar contains the class which I
> >>start from the command line.
> >>
> >>I also tried to start the product's exe with
> >>
> >>     rcpdemo -consolelog
> >>         -vmargs -javaagent:%ASPECTJ_HOME%\lib\aspectjweaver.jar
> >>
> >>but even with <include within="*"/> I didn't get any output from the apsect.
> >>
> >>Thanks, Stephan
> >>
> >>
> >>Alexandre Vasseur schrieb:
> >>
> >>>Hi
> >>>
> >>>Can you send me the exact command line you are using asuming f.e. you
> >>>have ASPECTJ_HOME and ECLIPSE_HOME set ?
> >>>
> >>>I am not familiar with that but I would assume you need to use -vmargs
> >>>Eclipse option and sort of.
> >>>Thanks
> >>>
> >>>On 7/1/05, Stephan Kolp <stephan.kolp@xxxxxxxxxx> wrote:
> >>>
> >>>
> >>>>Hello,
> >>>>
> >>>>I posted this problem to eclipse.technology.aspectj and I was suggested
> >>>>to post
> >>>>it here:
> >>>>
> >>>>I want to use load-time weaving with an Eclipse RCP Application and
> >>>>the -javaagent:aspectweaver.jar option but it doesn'nt work as it should.
> >>>>
> >>>>I start the application with
> >>>>
> >>>>java -javaagent:%ASPECTJ_HOME%\lib\aspectweaver.jar
> >>>>  org.eclipse.core.launcher.Main
> >>>>
> >>>>My aop.xml looks like this:
> >>>>
> >>>><aspectj>
> >>>> <aspects>
> >>>>   <aspect name="util.logging.LoggingAspect"/>
> >>>> </aspects>
> >>>> <weaver options=" -nowarn">
> >>>>   <include within="rcpdemo.*"/>
> >>>></weaver>
> >>>></aspectj>
> >>>>
> >>>>
> >>>>My aspect generates an output before any method call. This works fine for
> >>>>simple java applications but not for RCP applications. Allthough I get a
> >>>>lot
> >>>>of messages that classes are going to be woven (e. g.
> >>>>WeavingAdaptor.weaveClass org/eclipse/ui/internal/PerspectiveHelper) the
> >>>>desired output from the aspect does not appear.
> >>>>
> >>>>When I change the 'include within' attribute of aop.xml to "*" I get the
> >>>>same WeavingAdaptor messages and additional output from my aspect. But the
> >>>>aspect does not create output from method calls within any plugin. The
> >>>>output appears only for method calls within the eclipse launcher in the
> >>>>startup.jar.
> >>>>
> >>>>I know about the AJEER plugin but it works only with the AJDT 1.1.12 which
> >>>>are available for Eclipse 3.0. But is there any possibility to use
> >>>>load-time
> >>>>weaving with RCP applications developed with Eclipse 3.1 and upcoming
> >>>>versions?
> >>>>
> >>>>Regards, Stephan
> >>>>_______________________________________________
> >>>>aspectj-dev mailing list
> >>>>aspectj-dev@xxxxxxxxxxx
> >>>>https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> >>>>
> >>>
> >>>_______________________________________________
> >>>aspectj-dev mailing list
> >>>aspectj-dev@xxxxxxxxxxx
> >>>https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> >>>
> >>
> >>_______________________________________________
> >>aspectj-dev mailing list
> >>aspectj-dev@xxxxxxxxxxx
> >>https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> >>
> >
> > _______________________________________________
> > aspectj-dev mailing list
> > aspectj-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> >
>


Back to the top