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

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