Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, ctx.getBean("myEmf"));
env.set(EnvironmentName.TRANSACTION_MANAGER, ctx.getBean("txManager"));
KieStoreServices kstore = (KieStoreServices) ctx.getBean("kstore1");
service = kstore.loadKieSession(sessionId,
kbase,
null,
env);
processInstance = service.getProcessInstance(processInstance.getId());
assertNotNull(processInstance);