Use FrameworkUtil to retrive the osgi bundle and FileLookup to retrieve ...

Sometimes ((BundleReference) OsgiClassLoader.class.getClassLoader()).getBundle()
returns null. To fix that use FrameworkUtil to retrive the osgi bundle [1]

Use FileLookup to find the resources on OSGI classpath as files for InfinispanEmbeddedServiceFactory are loaded by other bundles and not accessible using its class loader.

[1] http://grepcode.com/file/repo1.maven.org/maven2/org.osgi/org.osgi.core/4.2.0/org/osgi/framework/FrameworkUtil.java#FrameworkUtil.getBundle%28java.lang.Class%29
FileLookup shouldn't be required I believe to load the config unless (1) the config is in the default package or (2) the package is not exported by the bundle containing the config. In my opinion it's better to require for the config to be properly "exposed" by the client bundles for these two cases instead of using FileLookup (which does a full container scan loading the resources using the CL of the bundle directly and this is not very OSGi-friendly).

The infinispan-osgi bundle uses DynamicImport-Package * to be able to load the resources exported by other bundles.