Hi,

I'm trying to setup an OSGi framework instance (Felix) then to install two bundles and finally getting a reference to a ComponentFactory inside the framework via a ServiceListener. No Exceptions are thrown but my ServiceListener ist not getting any events.

You can have a look at the code here:
https://github.com/Sandared/jmh-benchmarks/blob/master/benchmarks/src/main/java/io/jatoms/jmh/OSGiBenchmark2.java

Or If you want to execute it and play  with it you can run it here:
https://gitpod.io/#https://github.com/Sandared/jmh-benchmarks/blob/master/benchmarks/src/main/java/io/jatoms/jmh/OSGiBenchmark2.java

just type the following commands into the terminal:
cd benchmarks
mvn clean install
java -jar target/benchmarks.jar

I also tried to acquire the service directly by starting the bundles, then wait a second and then calling bundleContext.getServiceReference(ComponentFactory.class). But when I tried to turn this reference into a service via

ComponentFactory<ITest> factory = bundleContext.getService(ref);

I get a ClassCastException stating that Felix SCR's ComponentFactoryImplementation cannot be cast to ComponentFactory... which doesn't make much sense to me, as the ComponentFactoryImplementation implements ComponentFactory.

Am I doing something fundamentally wrong?

Kind regards,
Thomas

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to