JBoss Community

Re: InvocationTargetException when creating StatefulKnowledgeSession

created by Tim Kutz in jBPM - View the full discussion

jtaManager is the JBoss TransactionManager (arjuna).  It's injected, as the class where the above code lives is actually an MBean.

 

I've made some - limited - progress with this.  It appears that the JPAKnowledgeService doesn't like to participate in an existing JTA transaction.  By marking the method with @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED), I am able to get a session created within a UserTransaction.  The code now looks like this:

 

UserTransaction txn = retrieveTransaction();

txn.begin();

kSession =

    JPAKnowledgeService.newStatefulKnowledgeSession( kBase, null, env );

kSession.getWorkItemManager().registerWorkItemHandler("ValidationService", new ValidationTaskWorkItemHandler());

kSession.getWorkItemManager().registerWorkItemHandler("SubscriptionEventUpdateService", new SubscriptionHistoryWorkItemHandler());

kSession.getWorkItemManager().registerWorkItemHandler("ImmunizationService", new JMSWorkItemHandler());

kSession.getWorkItemManager().registerWorkItemHandler("SchoolFormService", new JMSWorkItemHandler());

kSession.getWorkItemManager().registerWorkItemHandler("LegacySubscriptionService", new JMSWorkItemHandler());

 

I'm not thrilled about having to deal with UserTransaction, though.  Isn't this supposed to support standard managed transactions?  Is there something additional I need to provide to the env for it to participate normally?

Reply to this message by going to Community

Start a new discussion in jBPM at Community