Hi there,
In this example I’m using Windows 8.1, Java 1.7, eclipse and Bonita 6.3.8…
I’m using the example Maven project to do some batch programming but have a few questions, see here :
Situation:
I have a running 6.3.8 Tomcat Portal where I have installed an organization, a admin user and a single process (process00, more of this later).
All OK and I can log on etc. and the process is visible via Admin sign-in.
When I run the Maven Project, I have a -Dbonita.home=“E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita” pointing to bonita.home. Yes, I’ve checked it is the same as the running portal.
The Maven project Signs in and does everything I want of it except…
everything I want it to do as follows:
1) List the deployed processes, from documentation here.
In this case I have added one line to Main
Listthedeployedprocesses() ; //calling new module to list all deployed processes
private static void Listthedeployedprocesses() throws BonitaException {
System.out.println("Trace - Listthedeployedprocesses: In ");
// login
APISession session = doTenantLogin(USER_NAME, PWD);
try {
System.out.println("Trace - Listthedeployedprocesses: processAPI ");
final ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(session);
System.out.println("Trace - Listthedeployedprocesses: SearchOptions ");
final SearchOptions searchOptions = new SearchOptionsBuilder(0, 100)
.sort(ProcessDeploymentInfoSearchDescriptor.DEPLOYMENT_DATE, Order.DESC).done();
System.out.println("Trace - Listthedeployedprocesses: SearchResult ");
final SearchResult<ProcessDeploymentInfo> deploymentInfoResults = processAPI
.searchProcessDeploymentInfos(searchOptions);
System.out.println("Trace - Listthedeployedprocesses: for count: "+ deploymentInfoResults.getCount());
for (ProcessDeploymentInfo deployedProcess : deploymentInfoResults
.getResult()) {
System.out.println("Trace - Listthedeployedprocesses: deployedProcess: \n"
+ "id = "
+ deployedProcess.getId()
+ "\n"
+ "name = "
+ deployedProcess.getName()
+ "\n"
+ "version = " + deployedProcess.getVersion());
}
} finally {
// logout
doTenantLogout(session);
}
System.out.println("Trace - Listthedeployedprocesses: Out ");
}
The result I get is:
Trace - Listthedeployedprocesses: In
User ‘walter.bates’ has logged in!
Trace - Listthedeployedprocesses: processAPI
Trace - Listthedeployedprocesses: SearchOptions
Trace - Listthedeployedprocesses: SearchResult
Trace - Listthedeployedprocesses: for count: 0
User ‘walter.bates’ has logged out!
Trace - Listthedeployedprocesses: Out
There are NO processes in the service…where are they even though I have imported and enabled one (proces00 online) it does not show…
2) Deploy and enable a process from a bar file, from documentation here…
In this case I have added one line to Main
Deployandenableaprocessfromabarfile() ; //calling new module to deploy and enable a BAR file
private static void Deployandenableaprocessfromabarfile()
throws BonitaException {
System.out.println("Trace - Deployandenableaprocessfromabarfile: In ");
// login
APISession session = doTenantLogin(USER_NAME, PWD);
try {
// create a business archive
System.out.println("Trace - Deployandenableaprocessfromabarfile: BusinessArchive ");
final BusinessArchive businessArchive = BusinessArchiveFactory
.readBusinessArchive(new File("C:\\Users\\userX\\637-b\\process01--1.0.bar"));
// deploy and enable the process
System.out.println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition ");
final ProcessDefinition processDefinition = getProcessAPI(session)
.deployAndEnableProcess(businessArchive);
System.out.println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition.id "
+ "\nid"
+ processDefinition.getId()
+ "\nname"
+ processDefinition.getName()
+ "\nversion"
+ processDefinition.getVersion());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
// logout
doTenantLogout(session);
}
System.out.println("Trace - Deployandenableaprocessfromabarfile: Out ");
}
Here I get a different issue:
Exception in thread "main" org.bonitasoft.engine.bpm.process.ProcessEnablementException: USERNAME=walter.bates | org.bonitasoft.engine.core.process.definition.exception.SProcessEnablementException:
Process process01 with version 1.0 can’t be enabled since all dependencies are not resolved yet
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.enableProcess(ProcessAPIImpl.java:881)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.deployAndEnableProcess(ProcessAPIImpl.java:701)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)
at org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:276)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
at com.sun.proxy.$Proxy15.deployAndEnableProcess(Unknown Source)
at org.bonitasoft.example.App.Deployandenableaprocessfromabarfile(App.java:348)
at org.bonitasoft.example.App.main(App.java:150)
Caused by: org.bonitasoft.engine.core.process.definition.exception.SProcessEnablementException: Process process01 with version 1.0 can’t be enabled since all dependencies are not resolved yet
at org.bonitasoft.engine.core.process.definition.ProcessDefinitionServiceImpl.enableProcessDeploymentInfo(ProcessDefinitionServiceImpl.java:264)
at org.bonitasoft.engine.api.impl.transaction.process.EnableProcess.execute(EnableProcess.java:57)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.enableProcess(ProcessAPIImpl.java:877)
… 15 more
This is incorrect, how can I tell, because when I import process00 (from BAR) and enable via the Portal - it works 100%, nothing is missing.
Why is this an issue - because process01 is a Studio duplicate of process00, exported to a BAR and used as a test for batch import.
Finally, 3) wanting to see what the Portal looks like,
I remove the line in the program undeployProcess(processDefinition); So the sample process will stay present in the system.
I log off the portal and logon again as Administrator.
When I look at Apps I only see the manually installed/enabled process00 and not the one I have defined via the Maven project, nor the installed but unenabled app process01.
Which I know exists because of the resulting output from 1) above when I moved the call to after deployment.
Trace - Listthedeployedprocesses: processAPI
Trace - Listthedeployedprocesses: SearchOptions
Trace - Listthedeployedprocesses: SearchResult
Trace - Listthedeployedprocesses: for count: 1
Trace - Listthedeployedprocesses: deployedProcess:
id = 1
name = My first process
version = 1.0
My questions are,
Even though I have an executing Tomcat Portal, and I have my batch bonita.home pointing at the same “home”, where is the batch work being done and why can I not get a listing of all processes in the database?
Why can I not see all the processes in the Tomcat Bonita Home existence…? I would have thought I would see everything.
Why can I import a process online and enable it successfully but not in Batch? What I expect is that it would work successfully.
Are the batch and online nodes using the same database? They should be, but my results indicate not…so what is happening?
Can anyone help?
Many thanks and best regards
Seán