JBoss Community

Re: Why is Timer event not triggered in J2EE container?

created by Mare Geldenhuys in jBPM - View the full discussion

Hi Gary,

 

I think that your suspicion is correct. The original transaction you use to create the process finishes successfully, since it is only mandated to create the process and that happens without a problem. Therefore the original transaction has already commited and is not available when the timer fires.

 

Since the timer is executing now in the engine (StatefullKnowledgeSession) and transaction management has been specified as BMT. the engine now requires a transaction manager to get a transaction from it. And this is probably where the problem arises.

 

The way you do that is by registering the Transaction Manager with the StatefullKnowledgeSession, and that is done upon creation/retrieval of the said StatefullKnowledgeSession. That means getting the Transaction Manager which is managed by Websphere in your case and passing it to the KnowledgeService through an Environment.

 

The question now really is, how are you creating your StatefullKnowledgeSession? If you are using the jbpm-gwt-core jar's sources CommandDelegate as an example, you will have to look at the following lines,

 

    Environment env = KnowledgeBaseFactory.newEnvironment();
    env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

 

This is where you will need to add the reference to your transaction manager,


env.set( EnvironmentName.TRANSACTION_MANAGER,  TransactionManagerServices.getTransactionManager() );// Change this to  where you get your transaction manager from

 

If this does not work, someone from the community with more experience will need to assist. Whichever way, please post your findings, as I would like to see how it pans out.

 

Mare

Reply to this message by going to Community

Start a new discussion in jBPM at Community