Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: AW: AW: AW: [equinox-dev] Classloading problems running EquinoxweavedAspectJ

Thank you Heiko.

Here is what I did after your last mail:

1-I've "bundlized" aspectjrt.jar into aspectjrt-osgi.jar, and copied it to the same place of the weaved equinox
My aspectjrt-osgi.jar has the following header in its manifest
Fragment-Host: org.eclipse.osgi;bundle-version="3.2.0.v20060601"

2-Run the equinox like this:
java -Dosgi.framework.extensions=aspectjrt-osgi.jar -jar org.eclipse.osgi_3.2.0.v20060601.jar -console

3-The following happens:

java.lang.NoClassDefFoundError: org/aspectj/lang/NoAspectBoundException
        at org.eclipse.osgi.baseadaptor.BaseAdaptor$ParentClassLoader.<init>(Bas
eAdaptor.java:76)
        at org.eclipse.osgi.baseadaptor.BaseAdaptor.<clinit>(BaseAdaptor.java:70
)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.createAdaptor(Eclipse
Starter.java:777)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarte
r.java:280)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja
va:173)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.j
ava:150)
Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.NoAspectBoundExcep
tion
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 8 more


However if I run like this it works fine:
java -Djava.ext.dirs=. -jar org.eclipse.osgi_3.2.0.v20060601.jar -console

I am not sure of the consequences (I would be glad to know it) of this in the long run, but I've installed some bundles with no problem. The weaving worked as well.

If you could help me to do it the right way that would be awesome.

Thanks again!

Kiev

Subject: AW: AW: AW: [equinox-dev] Classloading problems running EquinoxweavedAspectJ
Date: Tue, 18 Mar 2008 15:59:27 +0100
From: Heiko.Seeberger@xxxxxxxxxxxxx
To: equinox-dev@xxxxxxxxxxx

Kiev,

 

OSGi will not allow you any non-OSGi class loading tricks.

 

Yes, you can have a fragment for the system bundle. These are called framework extension bundles.

In order to be found by Equinox this fragment has to be co-located with the system bundle and you have to register it by the system property

osgi.framework.extensions=<FRAGMENT>

 

Heiko


Von: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] Im Auftrag von Kiev Gama
Gesendet: Dienstag, 18. März 2008 06:57
An: Equinox development mailing list
Betreff: RE: AW: AW: [equinox-dev] Classloading problems running EquinoxweavedAspectJ

 

Thanks for the response.

I have tried to run in two different ways:

1 - If I put aspectJrt.jar in the classpath I get an explicit dependency error on the AJ classes
2 - Then, I've set the aspectJ\lib in the java.ext.dirs option and I've got the error that I sent.

I'll check on that other tip that you gave me.
Can I use fragment bundles with the bundle 0 (framework bundle) ?

Thanks again




Subject: AW: AW: [equinox-dev] Classloading problems running Equinox weavedAspectJ
Date: Tue, 18 Mar 2008 14:18:12 +0100
From: Heiko.Seeberger@xxxxxxxxxxxxx
To: equinox-dev@xxxxxxxxxxx

Kiev,

 

Thank you for the information provided.

 

As far as I understand you are weaving some aspects into Equinox (into the FrameworkLogEntry), right?

 

This will create dependencies from Equinox to your classes and possibly to AspectJ (for example when using around advices). These dependencies cannot be resolved, because in OSGi only dependencies declared in the bundle manifest are visible.

 

Maybe you could put your classes and the AspectJ runtime library into a framework extension fragment (look for details in the Eclipse Wiki).

Any comments on this?

 

Another solution could be to use Equinox Aspects and load-time weaving.

 

Heiko

 


Von: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] Im Auftrag von Kiev Gama
Gesendet: Dienstag, 18. März 2008 05:53
An: Equinox development mailing list
Betreff: RE: AW: [equinox-dev] Classloading problems running Equinox weavedAspectJ

 

Actually I'm not using the Equinox from the Equinox Aspects project.
I'm doing AspectJ compile-time (offline) weaving of a standard Equinox framework.

AspectJ 1.5
Equinox 3.2.0


Does the list allow the attaching of a file?
I can attach the weaved jar.

Thanks for the help.


Subject: AW: [equinox-dev] Classloading problems running Equinox weaved AspectJ
Date: Tue, 18 Mar 2008 13:33:10 +0100
From: Heiko.Seeberger@xxxxxxxxxxxxx
To: equinox-dev@xxxxxxxxxxx

Kiev,

 

Could you please provide some more information about your setting?

 

- Are you using compile-time weaving or loag-time weaving by Equinox Aspects?

- Which AspectJ version are you using?

 

Further it could be valuable if you could attach your project(s) …

 

Heiko

 


Von: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] Im Auftrag von Kiev Gama
Gesendet: Dienstag, 18. März 2008 02:11
An: equinox-dev@xxxxxxxxxxx
Betreff: [equinox-dev] Classloading problems running Equinox weaved AspectJ

 

Hello,

I weaved Equinox framework v 3.2.0 with AspectJ and I am getting the following the weaved framework:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/osgi/framework/log/FrameworkLogEntry
Caused by: java.lang.ClassNotFoundException: org.eclipse.osgi.framework.log.FrameworkLogEntry
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)


The FrameworkLogEntry class is the weaved jar. Does anybody know in detail how the class loading works or why that is happening?

This version does not use digitally signed jars. I found errors regarding the hashing of classes with version 3.3 and that is why I've tried weaving a previous version.

Thanks,

Kiev Gama

 


Do more with your photos with Windows Live Photo Gallery. Get Windows Live-Free

 


Do more with your photos with Windows Live Photo Gallery. Get Windows Live—Free

 


Don't get caught with egg on your face. Play chicktionary!



Do more with your photos with Windows Live Photo Gallery. Get Windows Live—Free

Back to the top