jbpm hibernate persistence
joshjdevl Mar 14, 2011 10:41 PMHi,
We are using Hibernate as our persistence implementatio and Bitronix. I would like to configure JBPM peristence to use a hibernate entity manager so it can participate in our application transactions and go to our existing databases.
I've done something like this where I inject our jtaTransactionManager.
{code}
// create the entity manager factory and register it in the environment
final EntityManagerFactory emf = new EntityManagerFactoryImpl(
getSessionFactory(), PersistenceUnitTransactionType.JTA, true, null);
final Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
// env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER, jtaTransactionManager);
// create a new knowledge session that uses JPA to store the runtime
// state
final StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null, env);
{code}
However, I receive the following error. Any clues/hints?
{code}
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:116)
... 34 more
Caused by: java.lang.RuntimeException: Could not commit session
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:136)
... 39 more
Caused by: java.lang.NullPointerException
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:125)
... 39 more
{code}