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 ~