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