So I'm in the midst of porting a big OSGi-app to Virgo - and I'm having some headaches dealing with Virgos synthetic TCCL... I understand it's purpose and see how it helps in many ways. But it also creates issues (especially when porting things from a pure OSGi'world it sort of turns things upside down - if you are developing from scratch it will be easier). My particular headache is around the following:
Typically you'll have code, own or 3rd-party, that tries to load resources using the TCCL (configurations or other resources) - and these resources are typically held private (i.e. not part of your exports). If that is the case - the TCCL will not be able to locate the resourcs and you get failures. To workaround this I am now considering to forcefully set the TCCL in some appropriate places (to the bundles own classloader)...
Have I missed something ? Is there a better way of dealing with this ? I'm hoping so...
I guess this problem can be generalized... How do you deal with the TCCL needing to load things (classes or resources) that are to be held private ? (i.e. not exported)
The design of Virgo's TCCL support is that if you want a class or resource to be loaded via the TCCL, then you really are exposing that class or resource outside its bundle and therefore it makes sense to export it.
You have the option of using an unscoped plan to avoid the synthetic context bundle altogether.