Please discuss issues and tips related to Bonita BPM

+3 votes
asked May 14, 2014 in SzolgInt by szarnyasg (251 points)  

6 Answers

+2 votes
answered May 17, 2014 by makaij (37 points)  
edited May 18, 2014 by makaij

As we had problems with the Bonita 6 WS connector on the practice lesson I thought that we share our experiences with it as we could use it in our process.

We found a tutorial which can be a good starting point. You need to register to view the tutorial.

We managed to call the web services with the http://schemas.xmlsoap.org/wsdl/soap/http HTTP binding.

Best regards,
Pineapple team

+1 vote
answered May 15, 2014 by cseppento (294 points)  
edited May 20, 2014 by cseppento

Tips and tricks in Hungarian (not bugs!!!): http://q2a.inf.mit.bme.hu/1466/bonita-tippek-es-trukkok

Bonita Runtme API and Custom Objects

We had a problem using our custom (serializable) objects with the Bonita Runtime API.

Environment:
- Windows 8.1 64bit (Lajos), Windows 8 64bit (Ágnes)
- Bonita Community Edition 6.2.6 64 bit
- latest Oracle Java JDK 1.7 64bit (16/05/2014)

Description: the Runtime API worked well from Java until we started to use custom objects. Bonita throw an error about it could not deserialize/parse the object. We had the same binaries in our project and in Bonita and also used the corresponding maven dependency (version 6.2.6).

Detailed exception trace:

ápr. 16, 2014 8:31:53 DU org.bonitasoft.console.server.listener.StudioWatchdogListener$1 run
WARNING: Bonita Studio watchdog process has started on 6969 with a delay of 20000ms
ápr. 16, 2014 8:33:10 DU org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
WARNING: Work ExecuteFlowNodeWork: processInstanceId:1002, flowNodeInstanceId: 20009 failed. The failure will be handled.
ápr. 16, 2014 8:33:10 DU org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
WARNING: Exception was:org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
org.bonitasoft.engine.core.process.instance.api.exceptions.SFlowNodeExecutionException: org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:181)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeFlowNode(FlowNodeExecutorImpl.java:294)
    at org.bonitasoft.engine.execution.work.ExecuteFlowNodeWork.work(ExecuteFlowNodeWork.java:76)
    at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:48)
    at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:44)
    at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:241)
    at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:53)
    at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:76)
    at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:72)
    at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
    at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:45)
    at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
    at org.bonitasoft.engine.execution.StateBehaviors.handleCallActivity(StateBehaviors.java:541)
    at org.bonitasoft.engine.execution.state.InitializingActivityWithBoundaryEventsStateImpl.onEnterToOnFinish(InitializingActivityWithBoundaryEventsStateImpl.java:97)
    at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:73)
    at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:35)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeState(FlowNodeExecutorImpl.java:123)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:169)
    ... 16 more
Caused by: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.start(ProcessExecutorImpl.java:935)
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.start(ProcessExecutorImpl.java:892)
    at org.bonitasoft.engine.execution.StateBehaviors.instantiateProcess(StateBehaviors.java:565)
    at org.bonitasoft.engine.execution.StateBehaviors.handleCallActivity(StateBehaviors.java:536)
    ... 21 more
Caused by: org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.initialize(ProcessExecutorImpl.java:591)
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.start(ProcessExecutorImpl.java:924)
    ... 24 more
Caused by: org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator$1: Trying to set variable "chosenConfiguration" with incompatible type: com.ctc.wstx.stax.WstxOutputFactory cannot be cast to javax.xml.stream.XMLOutputFactory
    at org.bonitasoft.engine.bpm.model.impl.BPMInstancesCreator.createDataInstances(BPMInstancesCreator.java:559)
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.initialize(ProcessExecutorImpl.java:574)
    ... 25 more

Ágnes Barta, Lajos Cseppentő, Noémi Szilvásy

+1 vote
answered May 18, 2014 by hajdua (650 points)  

Passing custom objects through Bonita API

We had the following problem passing our custom typed (but serializable) objects to a Task or a Process using the Bonita Java API.

Environment:
- Windows 8.1 Professional (64 bit) and also Windows 7 Professional (32 bit)
- Bonita Community Edition 6.2.6 32 bit and also 64 bit
- JDK 1.7 32 bit and also 64 bit

We used the API like in the Embedded Engine example (GitHub). When passing a custom typed variable to a Process or a Task, we encountered the following exception (ConfigurationAttributes is our custom type):

com.thoughtworks.xstream.converters.ConversionException: hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes : hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes
---- Debugging information ----
message             : hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes
class               : java.util.HashMap
required-type       : java.util.HashMap
converter-type      : com.thoughtworks.xstream.converters.collections.MapConverter
path                : /object-array/map/entry/map/entry/hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes
line number         : 9
class[1]            : [Ljava.lang.Object;
converter-type[1]   : com.thoughtworks.xstream.converters.collections.ArrayConverter
version             : null
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    ...
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: hu.bme.mit.inf.pineapple.szolgint.ConfigurationAttributes
    at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:56)
    at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
    at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
    ...

The class ConfigurationAttributes was included in a jar under the dependencies of the Bonita process.

We also tried to use the local API of Bonita. We deployed the process into .bar files and started them locally from the Java application. In this case we got a SAXParserException when trying to pass our custom type.

+1 vote
answered May 19, 2014 by zmatyi (30 points)  

Hi!

We had the following issues related to BonitaBPMCommunity-6.2.6:

We had problem with exporting a new version of a project. After a successful export, project was not able to run. Restart Bonita solved the issue.

Another problem appeared with connecting catch error events to tasks in crowded pool. Reordering pool solved the issue.

A usability issue that mapping does not order data at all, so pairing data with different names are very inconvenient.

Best regards,
Mátyás Zoltánka, NameNotFound team

0 votes
answered May 18, 2014 by molnargab (42 points)  

We tried to use BonitaXML.evaluateXPathOnVariable in a Groovy script to parse the SOAP 1.2 response of the Currency Exchange Webservice of the Hungarian Nation Bank

It turned out using the // XPath selector, only the first match is returned instead of all the matches.

Version: 6.2.2 Community

Example code to parse the result (responseDocumentBody is the output of the SOAP 1.2 Connector):

def currencies = BonitaXML.evaluateXPathOnVariable(responseDocumentBody, "//GetCurrenciesResult/text()")
if (currencies instanceof String) {
   currencies = currencies.substring(currencies.indexOf('<'))
}
def currencyNames = BonitaXML.evaluateXPathOnVariable(currencies, "//Curr/text()")
0 votes
answered May 19, 2014 by molnargab (42 points)  
edited May 19, 2014 by molnargab

While querying process variables throught the Java API, several Map typed Java Objects were not returned properly (value was null). If it's not possible it should return some exception instead, or maybe even some warning in the Studio.

Consider the following test code:

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

import java.util.Map;

import org.bonitasoft.engine.api.ProcessAPI;
import org.bonitasoft.engine.api.TenantAPIAccessor;
import org.bonitasoft.engine.bpm.data.DataInstance;
import org.bonitasoft.engine.exception.BonitaException;
import org.bonitasoft.engine.session.APISession;
import org.junit.Test;

public class BonitaApiMapBug {

   @Test
   public void queryMapVariable() throws BonitaException {
       APISession session = TenantAPIAccessor.getLoginAPI().login("walter.bates", "bpm");
       ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(session);

       long processInstanceId = getProcessInstanceId();
       DataInstance processDataInstance = processAPI.getProcessDataInstance("mapVariable", processInstanceId);
       // the query is successful
       assertThat(processDataInstance, is(notNullValue()));

       // though this assertion fails:
       assertThat(processDataInstance.getValue(), is(not(nullValue())));
       assertThat(processDataInstance.getValue(), is(instanceOf(Map.class));
    }
}

Was using the Maven version of bonita-client 6.2.2 with Bonita 6.2.2 Community.

Also it would be really useful for testing, to have an API call, that blocks execution until the process instance is ready with the computation. E.g. after submitting a task, the testers need wait a random amount of time to be able to query the next task in the process.

...