You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by pchakinala <pr...@planetsoft.com> on 2012/05/22 17:22:21 UTC

OSGI Class Loading

Hi,
 We are using SMX 4.4 and camel 2.8.3. We have three bundles 

Bundle A and  Bundle B.

 Bundle A: 
  ---> Calls SERVICES which are located in Bundle B 
---> contains endpoint to call thirdparty service 

 Bundle B:
  ---> It contains OSGI Service which is used  Bundle A.This OSGI service
which uses our custom API classes.

 As per the below article and used Fragment bundle approach to export custom
API

http://freemanfang.blogspot.in/2012/03/how-to-use-jdbc-driver-in-osgi.html

As stated earlier  Bundle B require Custom API. So created fragment bundle
which imports Custom API packages  and added Bundle B as Fragment-Host
Bundle.  I have observed custom API classes are not available in run time.

However its working fine if i created fragment Bundle with Bundle A as
Fragment-host bundle instead of Bundle B as Host.
 
Why it is not working when Bundle B as Fragment-Host bundle? Actual Custom
API is used in osgi class at Bundle B.

 Please update me do you want me to share my source bundles.

Regards,
Praveen

 



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGI-Class-Loading-tp5713326.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGI Class Loading

Posted by Christian Schneider <ch...@die-schneider.net>.
Honestly I don´t understand why you need a fragment in this setup. You 
have a common api bundle, a service bundle and a client bundle to that 
service. So that should
work nicely if service and client import the api packages.

I have a tutorial where I show how to publish and use a simple service:
http://www.liquid-reality.de/x/DIBZ

If you use the fragment because of the DB access like the link to 
freeman´s article suggests you might use another aproach that does not 
need a fragment bundle.
In this article I describe how to publish a DataSource as an OSGi 
service and how to use it.
See:
http://www.liquid-reality.de/x/LYBk

Christian

Am 23.05.2012 09:04, schrieb pchakinala:
> Here atatched 3 bundles.
>
>   restful ---->  Bundle A ( This calls OSGI service hosted in Bundle B)
>   dataconverter --->  Bundle B contains OSGI service  (Utility class) which
> uses common API
>   test ---->   This is Fragment Bundle.
> sample1bundle --->  custom api jar
> Its working fine if i make  Bundle A as host bundle instead of Bundle B.
>
> As per my requirement,  Bundle B is used by all other bundles. So it should
> work if i import custom API to Bunble B.
>
> Is there any other way to implement my requirement.
>
> Thanks
> http://servicemix.396122.n5.nabble.com/file/n5713330/dataconverter.zip
> dataconverter.zip
> http://servicemix.396122.n5.nabble.com/file/n5713330/restful.rar restful.rar
> http://servicemix.396122.n5.nabble.com/file/n5713330/sample1bundle-1.0.0.jar
> sample1bundle-1.0.0.jar
> http://servicemix.396122.n5.nabble.com/file/n5713330/test.zip test.zip
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGI-Class-Loading-tp5713326p5713330.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: OSGI Class Loading

Posted by pchakinala <pr...@planetsoft.com>.
Here atatched 3 bundles.

 restful ----> Bundle A ( This calls OSGI service hosted in Bundle B)
 dataconverter ---> Bundle B contains OSGI service  (Utility class) which
uses common API
 test ---->  This is Fragment Bundle.
sample1bundle ---> custom api jar  
Its working fine if i make  Bundle A as host bundle instead of Bundle B.

As per my requirement,  Bundle B is used by all other bundles. So it should
work if i import custom API to Bunble B. 

Is there any other way to implement my requirement.

Thanks
http://servicemix.396122.n5.nabble.com/file/n5713330/dataconverter.zip
dataconverter.zip 
http://servicemix.396122.n5.nabble.com/file/n5713330/restful.rar restful.rar 
http://servicemix.396122.n5.nabble.com/file/n5713330/sample1bundle-1.0.0.jar
sample1bundle-1.0.0.jar 
http://servicemix.396122.n5.nabble.com/file/n5713330/test.zip test.zip 


 

--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGI-Class-Loading-tp5713326p5713330.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGI Class Loading

Posted by Filippo Balicchia <fb...@gmail.com>.
Stupid question .

are you sure that custom API are fragment-host of bundle b?

cheers

--Filippo

2012/5/22 pchakinala <pr...@planetsoft.com>:
> Hi,
>  We are using SMX 4.4 and camel 2.8.3. We have three bundles
>
> Bundle A and  Bundle B.
>
>  Bundle A:
>  ---> Calls SERVICES which are located in Bundle B
> ---> contains endpoint to call thirdparty service
>
>  Bundle B:
>  ---> It contains OSGI Service which is used  Bundle A.This OSGI service
> which uses our custom API classes.
>
>  As per the below article and used Fragment bundle approach to export custom
> API
>
> http://freemanfang.blogspot.in/2012/03/how-to-use-jdbc-driver-in-osgi.html
>
> As stated earlier  Bundle B require Custom API. So created fragment bundle
> which imports Custom API packages  and added Bundle B as Fragment-Host
> Bundle.  I have observed custom API classes are not available in run time.
>
> However its working fine if i created fragment Bundle with Bundle A as
> Fragment-host bundle instead of Bundle B as Host.
>
> Why it is not working when Bundle B as Fragment-Host bundle? Actual Custom
> API is used in osgi class at Bundle B.
>
>  Please update me do you want me to share my source bundles.
>
> Regards,
> Praveen
>
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGI-Class-Loading-tp5713326.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.