[jboss-user] [JBoss jBPM] - NullPointerException on rollback
do-not-reply at jboss.com
Fri Apr 25 18:32:18 EDT 2008
I have a question about jBPM behavior with external Connection.
Configuration is as follows.
* Set isTransactionEnabled = false to DbPersistenceServiceFactory in jbpm.cfg.xml
* Database transaction is managed by third party framework which is not JTA, which is simple connection based local transaction with template method pattern.
* Provided the external Connection via JbpmContext.setConnection method
* Commented out all JDBC connection properties in hinernate.cfg.xml
* Create our own ConnectionProvider to provide the external Connection, and set it to "hibernate.connection.provider_class" in hinernate.cfg.xml
With this environment, when hibernate throws Exception, DbPersistenceService thorws NullPointerException, and here is the stack trace.
It is happening because "transaction" field is NULL, because it's set when isTransactionEnable = true in beginTransaciton method when getSessiojn method is called.
I don't know very much about DbPersistenceService, but the code of close method doesn't add up. First block of code is wrapped by if stement with (isTransactionEnabled && (transaction != null)), which is good, but rest of the section three is no check against this condition and rollback method is called, and of course transaction field is NULL.
I'm not sure this check must be in close method or in rollback method, but this check should be in place somewhere to be consistent for isTransactionEnable.
Is my grasp right? and is three anybody who has already solved this issue?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146944#4146944
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146944
More information about the jboss-user