Thanks Marcel and Bruce I dont know how to share the interface between my app and bundle, do you have a working example? So far my app (embedded felix) can load a bundle and call a function (in bundle) by reflection, but it is very very inconvenience. I have searched google, seems no work around. Any idea? Suppose i am developing a bundle rely on another bundle, how can i import that bundle to my maven project? Really can't find anything in google too, please help.
Thanksfrom Peter > Subject: Re: questions about felix > From: [email protected] > Date: Sun, 13 Oct 2013 23:55:58 +0200 > To: [email protected] > > On Oct 13, 2013, at 22:54 PM, Peter Cheung <[email protected]> wrote: > > > Dear All I have a standalone java app that embedded felix. I can start > > it, load bundle and call the method from bundle (using reflection). 1) My > > first question is, using reflection is not efficiency. I imported the > > class from bundle to my host app, it popup "ClassCastException", because i > > cannot cast a class that loaded from felix to a class that loaded from > > default class loader, even two classes are the same. Any workaround?2) I am > > using maven, how to i add bundle dependency to pom.xml? pom.xml seems not > > searching the felix bundle repository. > > You cannot "see" classes that are loaded as part of bundles from your app. It > does not help to duplicate them either. The best option is to create an > interface, add that to your application, expose it as an exported package > through the system bundle, and have the class in the bunde import and > implement this interface. That way the interface is shared between the app > and any bundle that imports it. > > Hope that helps. > > Greetings, Marcel > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >

