ISSUE WITH USING THE ENGINE API TO START A PROCESS

There seems to be a big issue with the startProcess function in the ProcessAPI. I am using Coldfusion to call the Engine API. Everything is syntactically correct, however I am not able to start a process. I deployed and enabled a workflow process I created in the Bonita BPM Studio by clicking on the Install button in the Portal. However, when I try to start an instance of the process using the API, I get the following error message:

org.bonitasoft.engine.bpm.process.ProcessDefinitionNotFoundException: org.bonitasoft.engine.core.process.definition.exception.SProcessDefinitionNotFoundException: PROCESS_DEFINITION_ID=5154606022891079680 | Unable to find the process definition deployment info.

The strangest thing about this error message is that the PROCESS_DEFINITION_ID number that is being returned in this error message is not the number of the process that I am passing into the startProcess function, that number is 5154606022891079921. This process definition id number was found using the getProcessDefinitionId function in the ProcessAPI. What I am not understanding is why the startProcess function is not looking for the process id number that I am passing into it. I even tried hardcoding the id number into the function, and I still receive the same error. I have succeeded in starting a Process using the REST API, so it does not make sense why the Java API is not working. This happens with every process I have tried, even a simple process that just had one task, a start event, and an end event. It seems like it is an API problem. I have version 6.4 so please let me know if 6.5 perhaps fixed this problem. Here is part of my code in ColdFusion:

<cfset bnta_process_api = createObject(“java”,“org.bonitasoft.engine.api.TenantAPIAccessor”).getProcessAPI(bnta_api_session)/>

<cfset process_id = bnta_process_api.getProcessDefinitionId(“ApprovalProcess”,“1.0”)/>

Yes, been there and had a time understanding it also.

First things first I suppose, the examples in the Bonita documentation actually start a new Engine and do not use the same databases as what you might think you are using. that’s why you’re not seeing your process, it doesn’t exist in the engine you are working against.

Yes you might be pointing at the same libraries etc. but they do not actually interact. When the portal creates an engine it creates its own VM environment, like wise with your Coldfusion one, and the two VMs do not interact.

I’ll be honest I never really got the concept of having two clients working together on one engine working, which is a problem for me so I went to REST.

Using REST is much easier to do what you want, and as you’ve seen you can get it to work, it’s probably the easiest way to do it.

i wanted to do a lot of batch work with the client and engine but like i say couldn’t get it to work.

Apparently it’s covered in the advanced course Bonita put on… :slight_smile:

if you do find a way to do it, love to hear the answer.

regards
Sean

I am having the same error. I am new to bonitasoft. Can you please explain in detail where do we need to paste this code? Or what are the exact steps?

HI,
I want to migrate from bonita 5.5.2 to bonita 6.4.1 ! the problem is just i am obliged to use hibernate 4.2 but bonita 5.5.2 use hibernate 3.5.6 (compile).So waht is the solution and thanks

Hello. Thanks for your response. When using the Engine API with Coldfusion though, I was able to display the number of deployed processes, which is 2, and this corresponds to the number of processes that can be seen in the Portal. So it doesn’t really make sense then that they are operating in two different environments. Also it doesn’t explain why when I pass the process ID number into the startProcess function, it returns a different number back to me in the error message. Where is it getting this other number?

OK so you get 2, have you verified they are the same processes by printing out their names and version numbers? Sorry just being pedantic. Just the number two gives me the hebegebies though, so many times I get something like this and then find out it’s the wrong too.

When you start the process you are starting processA which has an ID=9789 say, the executing version of 9789 though will have an execution number though, for example processA executing id = 6789 and executing id = 6790, and so on for the executing process. I think this is what you are getting.

Yes I did verify that they are the same processes with the same names and version numbers.

org.bonitasoft.engine.bpm.process.ProcessDefinitionNotFoundException: org.bonitasoft.engine.core.process.definition.exception.SProcessDefinitionNotFoundException: PROCESS_DEFINITION_ID=5154606022891079680 | Unable to find the process definition deployment info.

So in this error message, you believe that the PROCESS_DEFINITION_ID that is being returned is actually the execution ID? That seems to be a problem with their API then that it is looking for an execution ID instead of a process definition ID which is what the function’s parameter is supposed to be.

Thanks!

No, sorry - I missed something completely…and gave a misleading/wrong answer.

Nothing like owning up to your mistakes. Let me have another read…

regards

Hi,

As the REST API calls the Engine API, I confirm that’s very strange that REST API is working and Engine API not.

Could you try to use the Engine API directly from a Java client using HTTP mode:

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

    final LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
    APISession session = loginAPI.login("walter.bates", "bpm");

    ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(session);

    long processDefinitionId = processAPI.getProcessDefinitionId("MyProcess", "1.0");
    processAPI.startProcess(processDefinitionId);

    loginAPI.logout(session);

Maven dependency:


<bonita.version>6.4.0</bonita.version>

<dependencies>
    <dependency>
        <groupId>org.bonitasoft.engine</groupId>
        <artifactId>bonita-client</artifactId>
        <version>${bonita.version}</version>
    </dependency>
</dependencies>