M Arnold [
https://community.jboss.org/people/marnold] created the discussion
"Drools / jBPM with EJB3 persistence and transactions"
To view the discussion, visit:
https://community.jboss.org/message/647812#647812
--------------------------------------------------------------
Hi,
I'm trying to use Drools and jBPM using EJB 3.0 and container managed transactions on
JBoss AS 5.1. My goal is to ensure that all jBPM work is performed in the container
managed transaction.
I've read the applicable documentation
http://docs.jboss.org/jbpm/v5.2/userguide/ch07.html here, but I'm still unsure about
how to achieve this.
In my SLSB I have:
@PersistenceUnit(unitName = "org.jbpm.persistence.jpa")
protected EntityManagerFactory emf;
@PersistenceContext
protected EntityManager em;
@Resource(mappedName = "java:/TransactionManager")
protected TransactionManager tm;
Then in a @PostConstruct I have:
env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, em);
env.set(EnvironmentName.TRANSACTION_MANAGER, tm);
But when I try:
ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null, env);
I get the exception:
Caused by: java.lang.ClassCastException:
com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate cannot be cast to
org.drools.persistence.TransactionManager
at
org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:265)
at
org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:115)
... 54 more
I checked the code, and I have to say I agree. ;-) I don't get it. I am expected to
create my own class which wraps a real javax.transaction.TransactionManager and implements
org.drools.persistence.TransactionManager? What is the correct way to do this?
Thanks in advance for any help, and my apologies if I missed something obvious...
in a stateless session bena
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/647812#647812]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]