Artem, 

It sounds like you have done something very strange.

Are you able to share the code and structure of your example project, eg on 
GitHub?

Regards,
Neil

-- 
Neil Bartlett
Sent from a phone


On Sunday, 26 October 2014 at 16:51, Artem Zhirkov wrote:

> Seems like I figured out a way to receive a service from host 
> application (I'm now getting ServiceReference from the BundleContext of 
> just installed Bundle, there is no ServiceReference to RepositoryAdmin 
> in Framework's BundleContext after bundle installation), but now I'm 
> stuck with:
> 
> java.lang.ClassCastException: 
> org.apache.felix.bundlerepository.impl.RepositoryAdminImpl cannot be 
> cast to org.apache.felix.bundlerepository.RepositoryAdmin
> 
> when
> ServiceReference ref =
> adminBundle.getBundleContext().getServiceReference(RepositoryAdmin.class.getName());
> 
> RepositoryAdmin repoAdmin = null;
> if (ref != null) {
> repoAdmin = 
> (RepositoryAdmin)adminBundle.getBundleContext().getService(ref);
> 
> 
> I know this happens when RepositoryAdmin interface is loaded from a 
> different classloader than where the RepositoryAdminImpl loads it from. 
> But I actually put org.apache.felix.bundlerepository package in system 
> exclusion (?) list in framework configuration:
> config.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, 
> "org.apache.felix.bundlerepository; version=2.0.2");
> 
> so it shouldn't happen? Why is it still happening and what can I do 
> about it?
> 
> 
> On 26.10.2014 11:28, Artem Zhirkov wrote:
> > Ok, so now I'm installing bundlerepository bundle from a jar file and 
> > then creating ServiceTracker using this code:
> > 
> > adminTracker = new ServiceTracker(adminConsumer.getContext(), 
> > RepositoryAdmin.class.getName(), null);
> > adminTracker.open();
> > 
> > in order to retrieve RepositoryAdmin service, but 
> > adminTracker.getServices() return null.
> > 
> > 
> > (adminConsumer is a host bundle activator, I'm trying to follow this 
> > tutorial 
> > http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostserviceusage
> >  
> > )
> > 
> > On 25.10.2014 19:05, Neil Bartlett wrote:
> > > You're probably missing a bundle that provides the service.
> > > 
> > > Neil
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> > For additional commands, e-mail: users-h...@felix.apache.org
> > 
> 
> 
> 


Reply via email to