org.bonitasoft.engine.exception.BonitaHomeNotSetException: You need to set the system property: bonita.home

Hi there.
I’m using Spring MVC 4 to authenticate with the Bonita Community 6.5 Engine.

But when performing the method

LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();

Receives an exception in return:

org.bonitasoft.engine.exception.BonitaHomeNotSetException: You need to set the system property: bonita.home

In fact I realize this setting in file bonita-client.properties

application.name=myClientExample
org.bonitasoft.engine.api-type=HTTP
server.url=http://localhost:8081

Could someone help me?

You need to set the property in your code before use getLoginAPI():

private static final String BONITA_HOME_KEY = “bonita.home”;
private static final String BONITAHOME = “C:\BonitaHome\bonita”;

System.setProperty(BONITA_HOME_KEY, BONITAHOME);
final LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();

It’s necessary to create the path for BonitaHome. I recommend to copy the folder C:\BonitaBPMCommunity-6.5.0-Tomcat-7.0.55\bonita\client to another path and in the file C:\BonitaBPMCommunity-6.5.0-Tomcat-7.0.55\bonita\client\conf\bonita-client.properties on the new folder created, change the configuration to your bonita address.

LOCAL

org.bonitasoft.engine.api-type = LOCAL

HTTP

org.bonitasoft.engine.api-type = HTTP
server.url = http://localhost:9090
application.name = bonita

In the origianl file bonita-client.properties don’t change it.

Tks carlos.oliveira_1
I setup the property with this method above, it works:

System.setProperty(“bonita.home”, “WE_BonitaAPI/src/main/resources/META-INF/”);