Hi,
I have a problem with an OSGI fragment that does not resolve because of constraint issues. I have an RCP/RAP application that provides special fragments for RCP. These fragments add some jFreeChart based functionality which is not available in RAP. The RCP fragment adds new constraints to the bundle. Namely require a jFreeChart bundle.
Now I always get a warning:
Constraints from the fragment conflict with the host:
This is due to the fact that my fragment adds new constraints and the fragment is resolved at a time where the bundle already has been resolved. This is by osgi specification not allowed.
This is the documentation of the code that actually adds the resolve error (ResolverBundle.constraintsConflict()):
// this method iterates over all additional constraints from a fragment
// if the host is resolved then the fragment is not allowed to add new constraints;
// if the host is resolved and it already has a constraint of the same name then ensure the supplier satisfies the fragment's constraint
On the other hand I have found the following information in an IBM Rational Software documentation:
Fragments are treated as part of the host bundles. Relevant definitions of the fragment are merged with the host bundles definitions before the host is resolved, as long as the information does not conflict.
So it seems to me that actually host and fragment could/should be resolved at the same time allowing the fragment to add new constraints.
Like I said: In my case the bundle is resolved before the fragment. I don't know why and I don't know how to control this. Can anybody tell me if I am using a wrong approach?
I don't know if this is important but gemini blueprint is part of my target platform.
Any hints would be appreciated.
Regards,
Thorsten