try {
AbstractXmlApplicationContext applicationContext = new ResourceXmlApplicationContext(new FileSystemResource(file), xmlPreprocessors, parentContext, beanFactoryPostProcessors, false);
applicationContext.setDisplayName(name);
applicationContext.setClassLoader(classLoader);
ServiceFactory serviceFactory = new SpringConfigurationServiceFactory(applicationContext);
log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel");
kernel.registerService(new StringServiceName(name), serviceFactory);
}