Announcement Announcement Module
No announcement yet.
Visibility of resources Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Visibility of resources

    Hi Community

    I encountered the following problem using spring dm on a spring dm server:

    The Setup is as follows:
    Two Bundles are present and installed: Bundle A and Bundle B
    Bundle A provides a service which is consumed by Bundle B - and works.
    Bundle A therefore exports the service’s interface (using Export-Package: bundleA.service.serviceinterface in Manifest), Bundle B consequently imports the same interface (using Import-Package: bundleA.service.serviceinterface).

    Now, I have the following issue:
    Bundle B (consumer) should have access to a resource file (mconf.xml) in the root inside the jar of Bundle A (service provider).

    According to the documentation (, with the setting context-class-loader="service-provider" on service provider side (Bundle A), I should have access to the mconf.xml resource of Bundle A.

    The OSGi Service Platform Core Specification (latest version is 4.1 at time of writing) does not specify what types and resources are visible through the context class loader when an operation is invoked on a service obtained via the service registry. Since some services may use libraries that make certain assumptions about the context class loader, Spring Dynamic Modules enables you to explicitly control the context class loader during service invocation. This is achieved using the option context-class-loader attribute of the reference element.

    The permissible values for the context-class-loader attribute are:
    *client - during the service invocation, the context class loader is guaranteed to be able to see types on the classpath of the invoking bundle. This is the default option.
    *service-provider - during the service invocation, the context class loader is guaranteed to be able to see types on the classpath of the bundle exporting the service.
    *unmanaged - no context class loader management will occur during the service invocation
    Nevertheless, I can not access the resource from within Bundle B.

    Do there is a complete misunderstanding of the topic on my side?

    Cheers and Thanks for your help

    Last edited by Eazyjd; Sep 24th, 2009, 04:20 AM.

  • #2
    Sorry, was posted in the wrong Board... should belong to Spring Dynamic Modules Board. Please move and sorry for my mistake!