I have two bundle say A and B. A depends on B (specified as Required-Bundle:B at A's MANIFEST).
Now I installed both A, B bundles one by one (by calling BundleContext.installBundle). Then when I try to start bundle A, I'm getting following error
org.osgi.framework.BundleException: Could not resolve module: A [140]
Unresolved requirement: Require-Bundle: B; bundle-version="1.0.0"
I understand from the exception that bundle B is not yet started(resolved). Now how to solve this problem?
Only way to solve this problem is sorting bundles by it's dependencies? Or Are there any options like specifying a folder to OSGi runtime so that any bundle files copied to it will be activated?
By the way, I'm using equinox.
Make sure you install ALL of the bundles before you start ANY of them. I.e. you need to do this:
and NOT this:
In the second (wrong) scenario, you will get a resolution error because A depends on B and B doesn't exist yet as far as OSGi is concerned.
In the first (correct) scenario, when you start A, OSGi will work out that it needs to resolve both A and B in order to satisfy the dependencies.
[By the way, in your question you seem to be confusing starting with resolving: you said "B is not yet started(resolved)". These are different things entirely. B only needs to be installed before you start A, and OSGi will resolve it automatically when it needs to.]