To be complete, I should say that if you cannot configure your application the way I mention in my previous email, then your only other option is to use reflection in the host application and not directly reference the classes in question.

-> richard

Daniel Dewael wrote:
Hi guys,

First thanks for Felix, this is really a great endeavor and an enabling 
technology that will change a lot of things for us, Java developers.

I am trying to implement the "Using Services Provided by Bundles" example shown on the 
"Embedding Felix" page and run into problems.

I have packaged an implementation of host.service.command.Command in a bundle, 
which I package with the cool Maven plugin. To load this bundle I have added an 
AutoActivator:

            List list = new ArrayList();
            list.add(new AutoActivator(configMap));
            hostActivator = new HostActivator();
            list.add(hostActivator);

The ServiceTracker sees the command service being added and I can iterate 
through the services it tracks and use reflection to call methods on the 
implementation of Command that comes from the external bundle (CommandImpl).

But I can not cast CommandImpl to Command, as they are in two different class 
loaders (Command is in the bootstrap classloader that loaded HostApplication, 
while CommandImpl is in the classloader of the OSGI bundle).

I am pretty sure my mistake will be easy to spot for you guys. I am looking 
forward your help.

Cheers,
Dan


--------------------------------- All new Yahoo! Mail - ---------------------------------
Get a sneak peak at messages with a handy reading pane.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to