Tim Kutz [https://community.jboss.org/people/tim.kutz] created the discussion

"Re: InvocationTargetException when creating StatefulKnowledgeSession"

To view the discussion, visit: https://community.jboss.org/message/722867#722867

--------------------------------------------------------------
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
[https://community.jboss.org/message/722867#722867]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to