You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Vadeg <ni...@gmail.com> on 2009/12/30 12:55:35 UTC

Call bundle from host application

Greetings!

I've recreated example, where Bundle is called from Host Application 
from your site:

http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostservices

named "Using Services Provided by Bundles"

But I can't get it work.

The trouble is in getting service from bundle context. Felix check, is 
the class, loaded from bundle service reference is the same as the 
class, loaded from my app by comparing them by == 
(org.apache.felix.framework.ServiceRegistrationImpl#isClassAccessible)

But, of course it's not the same class, because they loaded by different 
classloaders. One class is loaded by classloader of my app, the other 
one with the same name is loaded by bundle classloader. Because of that, 
I can't call bundle from my app.

- I've put property FRAMEWORK_SYSTEMPACKAGES_EXTRA where put the package 
name of my interface.
- I have a jar with my interface. This jar is deployed as bundle in 
felix and present in classpath of my app.

It seems that it must work, but it didn't :)

Can someone provide a working example?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Call bundle from host application

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 12/30/09 9:36, Karl Pauls wrote:
> On Wed, Dec 30, 2009 at 12:55 PM, Vadeg<ni...@gmail.com>  wrote:
>    
>> Greetings!
>>
>> I've recreated example, where Bundle is called from Host Application from
>> your site:
>>
>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostservices
>>
>> named "Using Services Provided by Bundles"
>>
>> But I can't get it work.
>>
>> The trouble is in getting service from bundle context. Felix check, is the
>> class, loaded from bundle service reference is the same as the class, loaded
>> from my app by comparing them by ==
>> (org.apache.felix.framework.ServiceRegistrationImpl#isClassAccessible)
>>
>> But, of course it's not the same class, because they loaded by different
>> classloaders. One class is loaded by classloader of my app, the other one
>> with the same name is loaded by bundle classloader. Because of that, I can't
>> call bundle from my app.
>>
>> - I've put property FRAMEWORK_SYSTEMPACKAGES_EXTRA where put the package
>> name of my interface.
>> - I have a jar with my interface. This jar is deployed as bundle in felix
>> and present in classpath of my app.
>>
>> It seems that it must work, but it didn't :)
>>      
> Well, it looks like your bundle is getting its interface package from
> the installed bundle instead of from the system bundle. Maybe you
> didn't give a (or an incorrect) version to the package in the
> FRAMEWORK_SYSTEMPACKAGES_EXTRA?
>    

Or else the bundle providing the service only exports the service 
interface package and doesn't import it too, which means the framework 
couldn't substitute the one provided by the system bundle.

-> richard

> regards,
>
> Karl
>
>    
>> Can someone provide a working example?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>      
>
>
>    

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Call bundle from host application

Posted by Karl Pauls <ka...@gmail.com>.
On Wed, Dec 30, 2009 at 12:55 PM, Vadeg <ni...@gmail.com> wrote:
> Greetings!
>
> I've recreated example, where Bundle is called from Host Application from
> your site:
>
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostservices
>
> named "Using Services Provided by Bundles"
>
> But I can't get it work.
>
> The trouble is in getting service from bundle context. Felix check, is the
> class, loaded from bundle service reference is the same as the class, loaded
> from my app by comparing them by ==
> (org.apache.felix.framework.ServiceRegistrationImpl#isClassAccessible)
>
> But, of course it's not the same class, because they loaded by different
> classloaders. One class is loaded by classloader of my app, the other one
> with the same name is loaded by bundle classloader. Because of that, I can't
> call bundle from my app.
>
> - I've put property FRAMEWORK_SYSTEMPACKAGES_EXTRA where put the package
> name of my interface.
> - I have a jar with my interface. This jar is deployed as bundle in felix
> and present in classpath of my app.
>
> It seems that it must work, but it didn't :)

Well, it looks like your bundle is getting its interface package from
the installed bundle instead of from the system bundle. Maybe you
didn't give a (or an incorrect) version to the package in the
FRAMEWORK_SYSTEMPACKAGES_EXTRA?

regards,

Karl

> Can someone provide a working example?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org