Hi guys,
I’m working on a binding that depends on 3rd-party libraries which in turn make use of the java.util.ServiceLoader
facility. AFAIK, that doesn’t work right out of the box in an OSGi container, leading to java.util.NoSuchElementException
s when the service loader can’t find the service at runtime, despite being defined in the 3rd-party’s JAR at META-INF/services
.
Now, how does one go about resolving this? To me it seems SPI Fly is the way to go and openHAB does indeed reference it.
If my analysis is correct so far, is there any example how to augment the 3rd-party code for use in an openHAB binding. IOW, are there any openHAB-specific constraints I need to take into account while implementing it? For instance, SPI Fly offers two distinct ways to do things; a OSGi spec-complaint way and a SPI Fly-specific way. Would both work for openHAB? Likewise, dynamic or static weaving? Ok, openHAB provides support for dynamic weaving (org.apache.aries.spifly.dynamic.bundle
is active in my OH 3.0.1).
Also, can I expect SPI Fly to work within the bnd
/demo.app
debug environment and in production/karaf, in the same way?
Thanks!