Error while trying to deploy Bonita_Test_V.1.0.bos file

1
0
-1

Hi All,
I have one .bos file that I am trying to deploy by using Bonita API in my java code.

Following are the method that I am calling to deploy .bos file:

private void deployProcess() {
try {
System.out.println("Deploying process '" + processName + "'...");
String uploadedFilePath = uploadGeneratedBar();
// installProcessFromUploadedBar(uploadedFilePath);
String payloadAsString = "{\"fileupload\":\"" + uploadedFilePath + "\"}";

        executePostRequest("/API/bpm/process", payloadAsString);
        System.out.println("Process Enabled!");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}

private String uploadGeneratedBar() throws IOException, ClientProtocolException {
    // build the process example
    File barFile = new File(
            "D:/Prakhar/BonitaSoft/LatestBosFile/Bonita_Test_V.1.0.bos");

    HttpPost post = new HttpPost(BonitaConstants.BONITA_URI + "/portal/processUpload");

    MultipartEntity entity = new MultipartEntity();
    entity.addPart("file", new FileBody(barFile));
    post.setEntity(entity);

    HttpResponse response = httpClient.execute(post, httpContext);
    // barFile.delete();
    return EntityUtils.toString(response.getEntity());

}

private HttpResponse executePostRequest(String apiURI, String payloadAsString) {
try {
HttpPost postRequest = new HttpPost(BonitaConstants.BONITA_URI + apiURI);

        StringEntity input = new StringEntity(payloadAsString);
        input.setContentType("application/json");

        postRequest.setEntity(input);

        HttpResponse response = httpClient.execute(postRequest, httpContext);

        return response;

    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}

Following are the error that I am getting:
Deploying process 'Bonita_Test_V.1.0'...
Process Enabled!

org.bonitasoft.engine.bpm.process.ProcessDefinitionNotFoundException: USERNAME=walter.bates | org.bonitasoft.engine.core.process.definition.exception.SProcessDefinitionNotFoundException: PROCESS_NAME=Bonita_Test_V.1.0 | Can't find the process.
at org.bonitasoft.engine.api.HTTPServerAPI.invokeMethod(HTTPServerAPI.java:143)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:86)
at com.sun.proxy.$Proxy3.getLatestProcessDefinitionId(Unknown Source)
at bonita.test.Main.start(Main.java:78)
at bonita.test.Main.main(Main.java:62)
at < ========== Beginning of the server stack trace ========== >. ( )
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.getLatestProcessDefinitionId(ProcessAPIImpl.java:2255)
at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:462)
at org.bonitasoft.engine.api.impl.ServerAPIImpl$2.call(ServerAPIImpl.java:431)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:312)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:438)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:272)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:124)
at org.bonitasoft.engine.api.internal.servlet.HttpAPIServletCall.doPost(HttpAPIServletCall.java:112)
at org.bonitasoft.engine.api.internal.servlet.HttpAPIServlet.doPost(HttpAPIServlet.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
at Caused by: org.bonitasoft.engine.core.process.definition.exception.SProcessDefinitionNotFoundException.: PROCESS_NAME=Bonita_Test_V.1.0 | Can't find the process. ( )
at org.bonitasoft.engine.core.process.definition.ProcessDefinitionServiceImpl.getLatestProcessDefinitionId(ProcessDefinitionServiceImpl.java:501)
at org.bonitasoft.engine.api.impl.transaction.process.GetLatestProcessDefinitionId.execute(GetLatestProcessDefinitionId.java:38)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.getLatestProcessDefinitionId(ProcessAPIImpl.java:2253)
at ... 39 more. ( )

Looking forward for a favorable response.

-Praks

Comments

Submitted by Sean McP on Wed, 09/21/2016 - 00:10

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

  1. your code/log

Thanks and regards
Seán

1 answer

1
0
-1
This one is the BEST answer!

You're trying to use upload a BAR to upload a BOS?

This won't work. You need to upload a BAR. What you've done is

Diagram -> Export -> creates a BOS Source file for importing to another Studio instance

What you need to do is:

Server -> Build -> creates a BAR compiled file for importing to Portal as a process

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

Comments

Submitted by praks0000 on Wed, 09/21/2016 - 10:24

Bar deployment successful..
Thanks.

-Praks

Notifications