Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] LinkageError when using after returning aspect in AspectJ for OSGI

Yes,

with the latest version it works great ! Really nice.

I didn't checked the version of the plug-in's used  in  the demo.

Tx.

Martin Lippert wrote:
Hi Dirk!

I tried your example with the current build and it seems to work fine. Could you try your setting with the latest build of Equinox Aspects in order to verify this? (from your description I guess that you are using the older version that is part of the examples target project...)

HTH,
-Martin



Dirk Jacobs wrote:
Hi,

Tx for helping me out.

The included code is a variation of the demo of Heiko so you should add the target that's part of the demo.
The aspect is now written in .java/Annotation format
If you comment the line : initializable.initialize(); in TestAspect.java , you will see that everything works.
Otherwise you get the error :

Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "org/eclipse/equinox/weaving/demo/hello/internal/Initializable" at org.eclipse.equinox.weaving.hello.aspects.TestAspect.anotherConstruct(TestAspect.java:16) at org.eclipse.equinox.weaving.demo.hello.internal.Activator.start(Activator.java:21) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
  at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
  ... 14 more

Thanks again,


Dirk


Martin Lippert wrote:
Hi Dirk!

Do you have a small ready-to-use project that you can send me as zip? To me it looks like I should take a closer look into what happens here.

Thanks!
-Martin



Dirk Jacobs wrote:
I created an aspect bundle (a variation of the demo)

I want to have an initialize method called after a constructor has finished.

The aspect is triggered, but when I want to execute the initialize method, I got a linkage error.
All classes are public and the package is exported.

The aspect is as follows :
package org.eclipse.equinox.weaving.hello.aspects;
import org.aspectj.lang.annotation.AfterReturning;
import org.eclipse.equinox.weaving.demo.hello.internal.Initializable;

public aspect HelloAspect3 { after() returning(Initializable initializable) : call(org.eclipse.equinox.weaving.demo.hello.internal.Initializable+.new(..)) {
       if( initializable != null) {
           System.out.println("After Initializable Constructor");
           initializable.initialize();
       } else {
           System.out.println("After Non-Initializable Constructor");
       }
   }
}

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev

------------------------------------------------------------------------

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
begin:vcard
fn:Dirk Jacobs
n:Jacobs;Dirk
org:iSencia Belgium
adr:;;Kerkstraat 108;Gent;;9050;Belgium
email;internet:dirk.jacobs@xxxxxxxxxx
tel;work:+32 9 27.27.932
x-mozilla-html:TRUE
url:http://www.isencia.be
version:2.1
end:vcard


Back to the top