Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Re: RCP Application LTW problem

Hi Martin,

Thanks for your help, it worked!

I hate to ask but this was an experiment to ensure I could get an RCP app working with the aop.xml aspect configuration.


Another requirement I have to abide by is that the company I work for has a target platform which is based on RCP 3.2. It may change in the future but not anytime soon. We have many teams spread out in various locations and that is one of the reasons change comes a bit slowly.

I notice that Equinox Aspects requires RCP 3.4 at the least. So I assume that is not an option for us, though I do like it a lot.

In my web searches I found that your earlier work produced the AJEER project which is supposed to work with 3.2. It seems documentation on using it is not readily available though.

Is it possible to configure an aop.xml file with AJEER? If so, can you point me out to documentation on doing so? I would also like to be able to create concrete aspects from abstract aspects too.



Thanks again for all your help.

Burt



On Mon, Jul 21, 2008 at 11:16 PM, Martin Lippert <lippert@xxxxxxx> wrote:
Hi Burt,

you don't need to repost to the equinox-dev list, I am reading this list as well... :-)

So, lets see how we can get your RCP app running.


So I've done the following so far:
1. Created a target platform based on RCP 3.4.
2. Added the following plugins to the target platform:

  - org.aspectj.runtime_1.6.1.20080703120000
  - org.aspectj.weaver_1.6.1.20080703120000
  - org.eclipse.equinox.weaving.aspectj_1.0.0.200807082136
  - org.eclipse.equinox.weaving.caching.j9_1.0.0.200807082136
  - org.eclipse.equinox.weaving.caching_1.0.0.200807082136
  - org.eclipse.equinox.weaving.hook_1.0.0.200807082136

Looks good.


3. Created the Hello RCP sample application. Created a .product file to use
to run the application.
2. Created a META-INF/aop.xml file that used the one aspect defined in the
sample RCP application.

Sounds good as well.


3. Set the VM arg
"-javaagent:F:\hello3.4Workspace\target.3.4\plugins/org.aspectj.weaver_1.6.1.20080703120000/aspectjweaver.jar"

This is not necessary. Using equinox aspects you don't need to specify a weaving agent or something like that. Instead you tell the osgi runtime to use equinox aspects and configure equinox aspects properly. To do so, please take a look at:

http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php

The last step in this guide might not be fitting perfectly for an RCP app since you don't want to use the console to start your app nor the weaving service. Therefore you would need to write your own config.ini file that looks like this:

osgi.bundles=org.eclipse.equinox.common@2\:start,org.eclipse.update.configurator@3\:start,org.eclipse.core.runtime@start, org.eclipse.equinox.weaving.aspectj@4\:start
osgi.splashPath = platform:/base/plugins/org.eclipse.platform
osgi.framework.extensions=org.eclipse.equinox.weaving.hook

Don't forget to add require-bundle to org.aspectj.runtime in your aspect bundle and re-export this bundle. And also don't forget to specify the Eclipse-SupplementBundle header in your aspect bundle to tell equinox aspects which bundles to possibly weave with the aspect.

HTH,
-Martin



Burt Leung wrote:
Thank you again and sorry for posting in the wrong forum. I'll try the
equinox-dev forum as you suggested.

Burt


On Mon, Jul 21, 2008 at 3:58 PM, Andy Clement <andrew.clement@xxxxxxxxx>
wrote:

Hi Burt,

>From your description, I don't think you are doing anything wrong - but I'm
not an expert on equinox aspects.  Those experts (like Martin Lippert) hang
out on the equinox-dev mailing list, although I know Martin reads this list
too. Maybe if he doesn't spot your post here then you could repost on that
list.

cheers,
Andy.

2008/7/21 Burt Leung <burt.leung@xxxxxxxxx>:

Sorry I am reposting this since I don't see my thread in the listing. If
this is the wrong forum/list to post to can someone point out which one I
should go to?

Thanks, any help would be greatly appreciated. Our company produces RCP
applications but we are only starting to look into using AspectJ.

Burt



On Mon, Jul 21, 2008 at 10:21 AM, Burt Leung <burt.leung@xxxxxxxxx>
wrote:

Hi All,

I'm having problems getting the load-time weaving working on the RCP
Application project I'm working on.

To try to figure out what could be going wrong, I tried creating a simple
RCP application using the "Hello RCP" template/wizard via the Eclipse IDE.

So I've done the following so far:
1. Created a target platform based on RCP 3.4.
2. Added the following plugins to the target platform:

  - org.aspectj.runtime_1.6.1.20080703120000
  - org.aspectj.weaver_1.6.1.20080703120000
  - org.eclipse.equinox.weaving.aspectj_1.0.0.200807082136
  - org.eclipse.equinox.weaving.caching.j9_1.0.0.200807082136
  - org.eclipse.equinox.weaving.caching_1.0.0.200807082136
  - org.eclipse.equinox.weaving.hook_1.0.0.200807082136

3. Created the Hello RCP sample application. Created a .product file to
use to run the application.
2. Created a META-INF/aop.xml file that used the one aspect defined in
the sample RCP application.
3. Set the VM arg
"-javaagent:F:\hello3.4Workspace\target.3.4\plugins/org.aspectj.weaver_1.6.1.20080703120000/aspectjweaver.jar"


If I run the application the output gives:
============================
osgi> [DefaultClassLoader@331059] info AspectJ Weaver Version 1.6.1rc1
built on Thursday Jul 3, 2008 at 20:33:51 GMT
[DefaultClassLoader@331059] info register classloader
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@331059
[DefaultClassLoader@331059] info using configuration /META-INF/aop.xml
[DefaultClassLoader@331059] info register aspect aspects.HelloAspect
Jul 21, 2008 10:13:03 AM org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: experiment2/Application
java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/CodeSignature
   at
org.aspectj.weaver.patterns.KindedPointcut.read(KindedPointcut.java:245)
   at org.aspectj.weaver.patterns.Pointcut.read(Pointcut.java:286)
   at
org.aspectj.weaver.patterns.CflowPointcut.read(CflowPointcut.java:103)
   at org.aspectj.weaver.patterns.Pointcut.read(Pointcut.java:295)
   at org.aspectj.weaver.patterns.AndPointcut.read(AndPointcut.java:87)
   at org.aspectj.weaver.patterns.Pointcut.read(Pointcut.java:290)
   at
org.aspectj.weaver.AjAttribute$AdviceAttribute.read(AjAttribute.java:490)
   at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:101)
   at
org.aspectj.weaver.bcel.BcelAttributes.readAjAttributes(BcelAttributes.java:106)
   at
org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java:191)
   at org.aspectj.weaver.bcel.BcelMethod.<init>(BcelMethod.java:104)
   at
org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectType.java:248)
   at
org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:524)
   at
org.aspectj.weaver.ResolvedType.getDeclaredAdvice(ResolvedType.java:748)
   at
org.aspectj.weaver.ResolvedType.getDeclaredShadowMungers(ResolvedType.java:785)
   at
org.aspectj.weaver.ResolvedType.collectShadowMungers(ResolvedType.java:626)
   at
org.aspectj.weaver.ResolvedType.collectCrosscuttingMembers(ResolvedType.java:518)
   at
org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect(CrosscuttingMembersSet.java:78)
   at
org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect(CrosscuttingMembersSet.java:65)
   at
org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:203)
   at
org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:398)
   at
org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:239)
   at
org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:151)
   at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:262)
   at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:267)
   at
org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:245)
   at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:86)
   at
org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)
   at
sun.instrument.TransformerManager.transform(TransformerManager.java:122)
   at
sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
   at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:165)
   at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:554)
   at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:524)
   at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:455)
   at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:443)
   at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:423)
   at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)
   at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:368)
   at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:444)
   at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
   at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
   at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at
org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:313)
   at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
   at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1274)
   at
org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
   at
org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:867)
   at
org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
   at
org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
   at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:188)
   at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
   at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Jul 21, 2008 10:13:03 AM org.aspectj.weaver.tools.Jdk14Trace info
INFO: Dumping to F:\eclipse3.4\.\ajcore.20080721.101303.562.txt
============================


I confirmed that the class org.aspectj.lang.reflect.CodeSignature is in
the target platform though (via the aspectrt.jar file), so it is puzzling.

In addition, I then tried to debug the application by setting a
breakpoint to stop at any Exception that occurs. The debuggers first break
is at:
Thread [main] (Suspended (exception ClassNotFoundException))
   ClassLoader.findBootstrapClass(String) line: not available [native
method] [local variables unavailable]
   Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String)
line: 891
   Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line:
301
   Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line:
299
   Launcher$AppClassLoader.loadClass(String, boolean) line: 268
   Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 251
   InstrumentationImpl.loadClassAndCallPremain(String, String) line: 133

The class it can't find is given to be
"org.aspectj.weaver.loadtime.Agent". I checked and this class is also in the
target platform (via the aspectjweaver.jar file) so I'm puzzled by this.

I made sure that the product has the right dependencies set too. E.g. The
"org.aspectj.runtime" and "org.aspectj.weaver" plugins are depended on.


Any help would be appreciated, thanks.

Burt


_______________________________________________
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