Hi,
On 14.04.2012, at 18:08, fabiolf wrote:
> Hi All,
>
> I'm trying to create components and an instances using the iPOJO API. My
> objective is to build a layer able to create and instantiate ipojo
> components from regular deployed bundles. So, in this scenery, I have a
> bundle who provides a service and another bundle that consumes the service.
> I want to create two ipojo components, one provider and one consumer. My
> code for creating my provider is shown below (got it from the tutorial):
>
> new PrimitiveComponentType()
> .setBundleContext(m_context)
> .setClassName(ProviderA.class.getName())
> .setValidateMethod("start")
> .setInvalidateMethod("stop")
> .addService(new Service())
> .createInstance("TestProviderA");
>
>
> In my first attempt to archive my objective I have received an exception:
>
> java.lang.IllegalStateException: An interface cannot be loaded
>
> The interface can be found in a started bundle. So I got the bundle context
> from that bundle with m_context.getBundle(55).getBundleContext(). Then I
> received another exception:
>
> java.lang.IllegalStateException: An exception occurs during implementation
> class manipulation : cannot found the class file
> org/test/iPOJO/providerA/ProviderA.class
>
> I realized, then, that the code to create the ipojo component must be inside
> the same bundle who will contain the component. I think this is due to using
> multiple class loaders. Am I right? Why can't I create a component for a
> bundle inside another bundle? Are there any plans to let this happen?
>
It should work as you give the bundle context of the bundle containing the
component implementation class.
The error means that the bundle context you gave to the iPOJO API is not able
to find the .class file. Check that the .class file can be found in the right
bundle.
Regards,
Clement
> Thanks in advance!
> Fabio
>
> --
> View this message in context:
> http://apache-felix.18485.n6.nabble.com/Using-iPOJO-API-to-create-components-and-instances-tp4881802p4881802.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]