Hey list,
I recently started some experiments with Apache Felix (and also JBOSGI,
which uses it).
The goal was to run some bundles that are originally plugins for Eclipse.
Now, after I got it working with a lot of small workarounds, there are
only a few basic problems that make this a lot more difficult than seems
necessary.
One is that, apparently, visibility:=reexport only works for one "hop", ie:
,--
| Bundle A exports package a
| package a contains classes a.One and a.Two which extends a.One.
|
| Bundle B exports package b and requires + reexports Bundle A
| package b contains class b.Three which extends a.One.
|
| Bundle C requires Bundle B.
`-----
This works, classes in C can instantiate b.Three as well as a.One and a.Two.
If I introduce another hop, ie
,--
| Bundle C now requires + reexports Bundle B,
|
| Bundle D requires Bundle C.
`-----
Then Bundle D cannot instantiate anything from A directly.
Interestingly enough, however, D can instantiate b.Three (and from there
also a.One is found).
,--
| a.One (b.Activator <- super() from b.Three)
| b.Three (b.Activator)
| a.One (c.Activator <- super() from b.Three)
| b.Three (c.Activator)
| a.One (c.Activator)
| a.One (c.Activator <- super() from a.Two)
| a.Two (c.Activator)
| a.One (d.Activator <- super() from b.Three)
| b.Three (d.Activator)
| ERROR: Bundle D [24]
| Error starting file:/D:/Server/felix-framework-3.2.2/
| bundle/D_1.0.0.201107261651.jar (org.osgi.framework.BundleException:
| Activator start error in bundle D [24].)
| java.lang.NoClassDefFoundError: a/One
| at d.Activator.start(Activator.java:28)
| at org.a.f.f.u.secureAction.startActivator(SecureAction.java:629)
| at org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
| at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
| at org.apache.f.framework.Felix.setActiveStartLevel(Felix.java:1192)
| at org.apache.f.f.StartLevelImpl.run(StartLevelImpl.java:266)
| at java.lang.Thread.run(Thread.java:619)
`----------
So, to ask the actual question, is this supposed to work?
The OSGi spec seems to suggest that it was as B is expected to export
all packages that A exports and hence I would have thought that this
works transitively as well.
Equinox obviously does this and both the core plugins and those that I
am actually trying to run use this rather heavily, so getting the setup
working resulted in a royal mess of additional imports all over the place.
Any pointers are greatly appreciated, CC, please, if possible, as I am
not currently subscribed here.
Best regards,
Marko
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]