Hi,
This is how I create the session using the above spring configuration.
<pre><span style=' color: Blue;'>public</span> <span style=' color: Blue;'>static</span> StatefulKnowledgeSession createSession() <span style=' color: Blue;'>throws</span> Exception {
<span style=' color: Green;'>/*
* Create the knowledgebase using the required bpmn and drl files
*/</span>
KnowledgeBase kbase = readKnowledgeBase(<span style=' color: Maroon;'>"SampleHumanTaskFormVariables.bpmn"</span>);
<span style=' color: Green;'>//EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );</span>
EntityManagerFactory emf = (EntityManagerFactory) HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"entityManagerFactoryJbpmPersistanceJpa"</span>);
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
env.set( EnvironmentName.TRANSACTION_MANAGER, HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"bitronixTransactionManager"</span>) );
env.set( EnvironmentName.TRANSACTION, HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"bitronixTransactionManager"</span>) );
env.set( EnvironmentName.GLOBALS, <span style=' color: Blue;'>new</span> MapGlobalResolver() );
Properties properties = <span style=' color: Blue;'>new</span> Properties();
properties.put(<span style=' color: Maroon;'>"drools.processInstanceManagerFactory"</span>, <span style=' color: Maroon;'>"org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory"</span>);
properties.put(<span style=' color: Maroon;'>"drools.processSignalManagerFactory"</span>, <span style=' color: Maroon;'>"org.jbpm.persistence.processinstance.JPASignalManagerFactory"</span>);
KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
<span style=' color: Blue;'>return</span> JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
}
</pre>
Thanks!