[jboss-user] [jBPM] - Drools / jBPM with EJB3 persistence and transactions
M Arnold
do-not-reply at jboss.com
Fri Jan 20 06:44:07 EST 2012
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&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120120/f7826bd8/attachment-0001.html
More information about the jboss-user
mailing list