Creating the OsgiClassLoader must be moved out of the BundleActivator. Instead, create it within OsgiSessionFactoryService#getService and OsgiPersistenceProviderService.java#getService