Use Bonita Engine from a JAVA web application

1
0
-1

Hello!

I've used Bonita so time ago... but now I've trying some, that I dont know how to do. I'm using version 5.10.

Well, I explain my goal:

I've developed a JAVA webapp, that is a simple form where users insert some information. When user submit the form, I save the information at a database, and at this moment, I want connect with the Bonita Engine to run a process with some vars from application.

I've read many links and doc about Bonita APIs, but I dont know exactly how do it...

¿Some help for guide me?

Thanks and regards!

1 answer

1
0
-1

So basically on v5 what you would like is to include Bonita client dependency in your application (use Maven for that) and add this kind of Java code to your application:

                // Type of API to use. If
                System.setProperty(BonitaConstants.API_TYPE_PROPERTY, org.ow2.bonita.facade.Context.Standard.toString());

                UserOwner.setUser("admin");
                DomainOwner.setDomain(BonitaConstants.DEFAULT_DOMAIN);

And then call API as explained here: http://documentation.bonitasoft.com/5x/bos-59/development/bonita-executi...

Comments

Submitted by aperher on Wed, 10/29/2014 - 13:08

I have add "bonita-client-5.10.jar" to my project.

And this is my code to try to connect with the Bonita Engine:

        final ManagementAPI managementAPI = AccessorUtil.getManagementAPI();
        final RuntimeAPI runtimeAPI = AccessorUtil.getRuntimeAPI();
        final QueryRuntimeAPI queryRuntimeAPI = AccessorUtil.getQueryRuntimeAPI();

        final LoginContext loginContext = new LoginContext("Bonita", new SimpleCallbackHandler("admin", "xxxxxx"));
        loginContext.login();

But when try to initialize managementAPI. I have the next error

org.ow2.bonita.util.BonitaRuntimeException: org.ow2.bonita.facade.exception.BonitaInternalException: Bonita Error: baa_SIAPIAF_1
No mapping file "org.ow2.bonita.api.implementations" found.
        org.ow2.bonita.facade.impl.LocalAPIAccessorFactory.getObject(LocalAPIAccessorFactory.java:79)
        org.ow2.bonita.facade.impl.LocalAPIAccessorFactory.getStandardServerQueryAPIAccessor(LocalAPIAccessorFactory.java:88)
        org.ow2.bonita.facade.impl.StandardQueryAPIAccessorImpl.<init>(StandardQueryAPIAccessorImpl.java:27)
        org.ow2.bonita.facade.impl.StandardAPIAccessorImpl.<init>(StandardAPIAccessorImpl.java:26)
        org.ow2.bonita.util.AccessorUtil.getAPIAccessor(AccessorUtil.java:155)
        org.ow2.bonita.util.AccessorUtil.getAPIAccessor(AccessorUtil.java:165)
        org.ow2.bonita.util.AccessorUtil.getQueryDefinitionAPI(AccessorUtil.java:230)
        com.bintertechnic.sms.controllers.RegistroController.arrancarProceso(RegistroController.java:404)
        com.bintertechnic.sms.controllers.RegistroController.doPost(RegistroController.java:148)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Some help please?

Submitted by antoine.mottier on Wed, 10/29/2014 - 15:47

Did you also add all Bonita Client dependencies to your project? You also need to define the JVM system property BONITA_HOME with full path to your BONITA_HOME folder.

Notifications