Printing OSGI bundle classpath?

不羁岁月 提交于 2019-12-04 05:21:38

As others have indicated there is really no such thing as a "bundle classpath" - that's the whole point of OSGi. :)

What you can do is:

  • look at your bundle's headers to see which packages it imports, and whether they are required or mandatory

  • use PackageAdmin to find bundles that export packages with a given name

However AFAIK PackageAdmin is deprecated and there will be a new/extended mechanism to work with bundle wiring in 4.3.

It seems like your real motivation for this is classpath scanning to find & load resources. The fact that this is not easily possible is a side effect of enforcing module boundaries: you can't have a fence and at the same time allow anyone to walk on the lawn. There was a plan for a standard service that scans bundles on behalf of a client, but that seems to have been withdrawn (not sure why - maybe as consequence of the new 4.3 stuff).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!