[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] [Aspects] AOSGi without Eclipse


I am posting the following email exchange that concerns the use of the Equinox Hooks API:

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

Hi Mr Webster,

I am a student of computer science from germany and currently i am doing
my masters thesis. I have been interestedly looking at OSGi and aspects,
and since AOSGi had been released I have been playing around with it a
little bit.
I have one problem: I want to get AOSGi to work outside eclipse, just
the equinox framework with the necessary bundles. This seems to work,
but every time i install a co-opt bundle, i get a Nullpointer Exception:

     [java] java.lang.NullPointerException
     [java]     at
org.aspectj.osgi.hooks.AspectJStorageHook.getSupplementers(AspectJStorageHook.java:126)
     [java]     at
org.aspectj.osgi.hooks.AspectJStorageHook.initialize(AspectJStorageHook.java:271)
     [java]     at
org.eclipse.osgi.internal.baseadaptor.BundleInstall.begin(BundleInstall.java:84)

this happens in the following line:
supplementerName.equals(symbolicName)

It is because some BundleInfo members don't get initialized.
I couldn't find out why, and what really confuses me that this only
happens outside eclipse. Maybe you have had the same problem or you have
a hint for me...

Thanks in advance and best regards

Markus Weiten

markus@xxxxxxxxx
University of Erlangen-Nuernberg, Bavaria, Germany

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

Markus,

The NPE occurs because my StorageHook, rightly or wrongly, needs to be called _after_ the Equinox one. That hook initializes the BundleData in particular the symbolicName. The order in which hooks are created and called depends on CLASSPATH. If you change you build.xml slightly to ensure org.eclipse.osgi is first then you don't get the exception.

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

Hey Matthew,

have you tried to get co-opt bundles to work in my executioon
environment outside eclipse? I have, and I'm afraid I can't get it to
work.  Maybe I am doing wrong something with the creation of the
bundles. But when I am using demo.hello, demo,tracing and
demo.tracing.co-opt, it should work. I think I should at least get the
message "[org.aspectj.osgi] info supplementing demo.hello with
[demo.tracing.coopt]" which I get inside eclipse, but I don't.

Greets

Markus

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

Hi Matthew,

I have debugged a little bit and I have found out why the demo.hello
bundle didn't get supplemented: The bundles have to be installed in the
right order. First the supplementer, then the supplemented bundle. I
always put both in the "plugins" folder and the bundles dont't get
initialized in a specific order. I did not care about the order because
I thought when I start the demos inside eclipse there is also no special
order...

Greets

Markus

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

Markus,

It seems that the StorageHook, which implements the supplements mechanism, is initialized when the bundle is installed. The AspectJStorageHook could be enhanced to allow a co-opting bundle to be installed after its targets but the process _must_ occur before any class resolution and loading i.e. before a bundle is activated. The initialize() method is the only opportunity I have unless I use another hook.

In Eclipse i have "Clear the configuration area" checked on the Configuration tag of the Run configuration. This updates all of the bundles listed on the Plug-ins tab, This seems to ensure co-opted bundles are updated after co-opting bundles are installed. You are probably using the Run configurations that I wrote.

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/