Implement Bonita into Java EE Application



I am very new to Bonita.

I am trying to implement a Bonita process into a Java EE Application and deploy it to the Bonita Wildfly.

I have found the simple Example that connects to the running Bonita instance but when I deploy it as an ear file to my wildfly instance nothing happens. I cant see any output logs. Thats why I am curious if my Program is even running.

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.bonitasoft.engine.api.ApiAccessType;
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.api.LoginAPI;
import org.bonitasoft.engine.api.TenantAPIAccessor;
import org.bonitasoft.engine.identity.RoleSearchDescriptor;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserCriterion;
import org.bonitasoft.engine.identity.UserSearchDescriptor;
import org.bonitasoft.engine.session.APISession;
import org.bonitasoft.engine.util.APITypeManager;

public class ProcessDeployer {

public static void main(final String args[]) {
final Logger logger = Logger.getLogger("TestUserList");
try {

final Map map = new HashMap();
map.put("server.url", "http://localhost:8080");
map.put("", "bonita");
APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, map);

// Set the username and password
final String username = "William.Jobs";
final String password = "bpm";
// get the LoginAPI using the TenantAPIAccessor
final LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
// log in to the tenant to create a session
final APISession session = loginAPI.login(username, password);
// get the identityAPI bound to the session created previously.
final IdentityAPI identity = TenantAPIAccessor.getIdentityAPI(session);

// get the list of users
final List user = identity.getUsers(0, 30, UserCriterion.FIRST_NAME_ASC);

// display the list of userNames

for (int i = 0; i < user.size(); i++) {
System.out.println(((User) user.get(i)).getFirstName());

} catch (final Exception e) {
logger.log(Level.SEVERE, "ERROR RETRIEVING USERS", e);

This is what I have in my Maven Project. I want to build a Process and orchestrate it from my Java classes like Camunda. Is this even possible.

Thanks in Advance.

3 answers

This one is the BEST answer!

Ok, I better understand your need.

On one side, you have your Bonita Bundle running (under Tomcar or Wildfly), with all the runtime ready to deploy and run processes.

On the other side, you have your client application that interacts with Bonita.

Your code if fully operational, and can be run as a standalone application (not inside an App Server). Just call it from the command line, an IDE, ...

Once you have it running, deploy more complex processes using the link I mentioned above, or you can also use other examples like

And if you just want to code your processes in Java and operate them from a web interface, just use Bonita Portal, that comes shipped in Bonita Bundles.

Hope this clarifies things.


Submitted by Blaubunt on Wed, 12/30/2020 - 14:44

Thank you very much for helping me out. I ran the program inside command line and it worked like a charm. I am now able to deploy a .bar file from my Java project.

I dont want to code the whole process. What I need to do is bind logic that I have written inside Java-Classes to process Steps. So if Process Step A is reached, the code inside my java class runs. Is it right to do this with connectors? From my research I would have to write one connector per Java class that I have, is this right? In Camunda it is just so easy, you just embedd the Class name inside xml process and deploy the project with the process. Is there something similar in bonita?

Thanks in advance.

Submitted by emmanuel.duchas... on Thu, 12/31/2020 - 09:29

If the logic of your Java code can be reused just by changing some input parameters (Step ID, some String / Integer value in input, ...), then you can absolutely write only one connector for the whole process, and call it several times with different input parameters.

And remember that connectors are primarily designed to connect to external systems, so based on what you want to do in your java code, there might be better options...


Submitted by Blaubunt on Sat, 01/02/2021 - 15:46

Thank you for your answer. Since I don't want to connect to an external system a connector is maybe not what I need. Basically I have Java classes that do stuff with process variables when the step they are bound to is executed. In Camunda I worked with delegate classes. I Google for hours for an alternative in Bonita and the only thing I found was connectors. How could I accomplish what I need to do? I am very new to Bonita and I am really stuck with this problem.

Submitted by emmanuel.duchas... on Mon, 01/04/2021 - 16:09

Ok, so if all you want to do is use or update process variables, have a look at Bonita operations. They are natively supported and allow to read / write to process variables.





First of all, just a remark: recent Bonita versions only include Tomcat Bundle, as WildFly is not supported anymore. Bur of course, you can completely have an application running inside WildFly to points to Bonita running under a Tomcat appserver.

Regarding your program, it contains a main() method, so I guess it is designed to be run from the command line... how do you plan to trigger it from an ear file?

That being said, the Java code looks correct.

And once your code runs properly, have a look at for example of how to build, deploy, and start processes programmatically.

Hop this helps,



Submitted by Blaubunt on Tue, 12/29/2020 - 06:24


Thanks for your answer. What I am trying to do is build a logic for a Process and execute them together. Is the only way to add my Java Classes as Connectors to the process and then deploy the Process from Bonita Studio? I thought there should be a more coded approach.
I found an old installation of bonita with wildfly and it is running but I dont know how to deploy my Java Project so it runs on the Server. How can I make it run correctly?

Thanks in advance