In my osgi application I have three bundles, travel.api
, table.api
and utils
. travel.api
depends on table.api
Yes, this is a tricky one. In many cases the problem is even worse, it might not even be known which bundles will be required to deserialize a stream. For these, the compile time dependencies are just not the same as runtime dependencies.
To tackle these situations, I've used either DynamicImports-Package or use the BundleWiring API. Both worked out pretty well, Dynamic imports are easier though.
I'd say isolate the part that needs this class loading as much as you can in a separate bundle, and have that bundle use a DynamicImport.
Good luck, Frank