Org. jbpm. API. jbpmexception: No environment to get org. jbpm. PVM. Internal. session. repositorysession

Source: Internet
Author: User
Tags jbpm

Because of business requirements, our approval process for non-attendance documents is: if the initiator is a common employee, then the approval process is direct supervisor or department manager (direct supervisor) any one of them can sign, so I thought of using candidate-users, and using assignee can no longer meet my business needs. In this case, I encountered an incorrect question during the compilation process, after several twists and turns, I finally found a solution. I 'd like to share with you the solution:

It is because I used the taskimpl class in the code, and all accesses to xxximpl need to environment.
Environment can be enabled in two ways
1) environmentimpl Env = (environmentfactory) processengine). openenvironment ();
Try {
// Todo;
} Finally {
Env. Close ();
}


2) processengine.exe cute (new command (){
Public object execute (Environment env ){
// Todo:
}
});

The IOC container maintained by jbpm4 can see an environment. If environment is not enabled, all components in it cannot be used. For more information about the IOC architecture, see the source code. Attached a jbpm architecture Diagram


The processengine.exe cute () method automatically opens an environment, executes the passed callback method, and then closes environment.
If you use the services under the API package, jbpm4 will automatically maintain environment, which has nothing to do with spring and is the call mechanism of jbpm4 itself,

If the first method does not work, it may be because the Spring transaction is not enabled.

 

I would like to share with you ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.