Batch processing via API's - problems - like where are my processes!!

1
0
-1

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

  1. private static void Listthedeployedprocesses() throws BonitaException {
  2.  
  3. System.out.println("Trace - Listthedeployedprocesses: In ");
  4. // login
  5. APISession session = doTenantLogin(USER_NAME, PWD);
  6. try {
  7.  
  8. System.out.println("Trace - Listthedeployedprocesses: processAPI ");
  9. final ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(session);
  10. System.out.println("Trace - Listthedeployedprocesses: SearchOptions ");
  11. final SearchOptions searchOptions = new SearchOptionsBuilder(0, 100)
  12. .sort(ProcessDeploymentInfoSearchDescriptor.DEPLOYMENT_DATE, Order.DESC).done();
  13. System.out.println("Trace - Listthedeployedprocesses: SearchResult ");
  14. final SearchResult<ProcessDeploymentInfo> deploymentInfoResults = processAPI
  15. .searchProcessDeploymentInfos(searchOptions);
  16. System.out.println("Trace - Listthedeployedprocesses: for count: "+ deploymentInfoResults.getCount());
  17. for (ProcessDeploymentInfo deployedProcess : deploymentInfoResults
  18. .getResult()) {
  19. System.out.println("Trace - Listthedeployedprocesses: deployedProcess: \n"
  20. + "id = "
  21. + deployedProcess.getId()
  22. + "\n"
  23. + "name = "
  24. + deployedProcess.getName()
  25. + "\n"
  26. + "version = " + deployedProcess.getVersion());
  27. }
  28. } finally {
  29. // logout
  30. doTenantLogout(session);
  31. }
  32. System.out.println("Trace - Listthedeployedprocesses: Out ");
  33. }

The result I get is:

  1. Trace - Listthedeployedprocesses: In
  2. User 'walter.bates' has logged in!
  3. Trace - Listthedeployedprocesses: processAPI
  4. Trace - Listthedeployedprocesses: SearchOptions
  5. Trace - Listthedeployedprocesses: SearchResult
  6. Trace - Listthedeployedprocesses: for count: 0
  7. User 'walter.bates' has logged out!
  8. 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

  1. private static void Deployandenableaprocessfromabarfile()
  2. throws BonitaException {
  3.  
  4. System.out.println("Trace - Deployandenableaprocessfromabarfile: In ");
  5. // login
  6. APISession session = doTenantLogin(USER_NAME, PWD);
  7. try {
  8.  
  9. // create a business archive
  10. System.out.println("Trace - Deployandenableaprocessfromabarfile: BusinessArchive ");
  11. final BusinessArchive businessArchive = BusinessArchiveFactory
  12. .readBusinessArchive(new File("C:\\Users\\userX\\637-b\\process01--1.0.bar"));
  13. // deploy and enable the process
  14. System.out.println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition ");
  15. final ProcessDefinition processDefinition = getProcessAPI(session)
  16. .deployAndEnableProcess(businessArchive);
  17. System.out.println("Trace - Deployandenableaprocessfromabarfile: ProcessDefinition.id "
  18. + "\nid"
  19. + processDefinition.getId()
  20. + "\nname"
  21. + processDefinition.getName()
  22. + "\nversion"
  23. + processDefinition.getVersion());
  24.  
  25. } catch (IOException e) {
  26. // TODO Auto-generated catch block
  27. e.printStackTrace();
  28. } finally {
  29. // logout
  30. doTenantLogout(session);
  31. }
  32. System.out.println("Trace - Deployandenableaprocessfromabarfile: Out ");
  33. }

Here I get a different issue:

  1. Exception in thread "main" org.bonitasoft.engine.bpm.process.ProcessEnablementException: USERNAME=walter.bates | org.bonitasoft.engine.core.process.definition.exception.SProcessEnablementException:
  2.  
  3. Process process01 with version 1.0 can't be enabled since all dependencies are not resolved yet
  4.  
  5. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.enableProcess(ProcessAPIImpl.java:881)
  6. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.deployAndEnableProcess(ProcessAPIImpl.java:701)
  7. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  8. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  9. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  10. at java.lang.reflect.Method.invoke(Unknown Source)
  11. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)
  12. at org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)
  13. at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:276)
  14. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)
  15. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)
  16. at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)
  17. at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
  18. at com.sun.proxy.$Proxy15.deployAndEnableProcess(Unknown Source)
  19. at org.bonitasoft.example.App.Deployandenableaprocessfromabarfile(App.java:348)
  20. at org.bonitasoft.example.App.main(App.java:150)
  21. 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
  22. at org.bonitasoft.engine.core.process.definition.ProcessDefinitionServiceImpl.enableProcessDeploymentInfo(ProcessDefinitionServiceImpl.java:264)
  23. at org.bonitasoft.engine.api.impl.transaction.process.EnableProcess.execute(EnableProcess.java:57)
  24. at org.bonitasoft.engine.api.impl.ProcessAPIImpl.enableProcess(ProcessAPIImpl.java:877)
  25. ... 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.

  1. Trace - Listthedeployedprocesses: processAPI
  2. Trace - Listthedeployedprocesses: SearchOptions
  3. Trace - Listthedeployedprocesses: SearchResult
  4. Trace - Listthedeployedprocesses: for count: 1
  5. Trace - Listthedeployedprocesses: deployedProcess:
  6. id = 1
  7. name = My first process
  8. 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

Comments

Submitted by haris.subasic on Mon, 12/22/2014 - 09:47

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.

Did you try to import manually in the Portal process01? And if your process00 works via Portal, did you try to use this one in your batch (just to check if it works...)?

Submitted by Sean McP on Sun, 01/11/2015 - 07:27

Hi Haris,

Still an issue,

Yes I did try it manually, and with several other BARS, which I then disable and delete to make sure everything is OK. They all exhibit the same problem.

Online - I can Import them no problem, via the batch API it seems to import but it does not enable.

Also, as I have said , if I shutdown and open the portal (even though using the same home) it does not show the process has been imported (even if unenabled).

I'm assuming that by using the same home, you are implicitly saying use the same database repositories. In this case H2, but why aren't they showing?

UPDATE:

Ok so I thought there must be a different way of testing this, so I thought Deploy only.

My result is:

  1. Trace - Deployaprocessfromabarfile: In
  2. User 'walter.bates' has logged in!
  3. Trace - Deployaprocessfromabarfile: BusinessArchive
  4. Trace - Deployaprocessfromabarfile: ProcessDefinition
  5. Trace - Deployaprocessfromabarfile: ProcessDefinition.id
  6. id8248350021795833151
  7. nameprocess01
  8. version1.0
  9. User 'walter.bates' has logged out!
  10. Trace - Deployaprocessfromabarfile: Out

This is now officially strange, especially when I'm using the same bonita.home, Deploy works - but it shouldn't as it already exists...it should have thrown an AlreadyExistsException which it didn't.

which means bonita.home must be wrong...but in my execution I have logs as follows:

From the Batch program:

  1. 'bonitaHome = E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita'
  2. Dec 22, 2014 12:39:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  3. INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6dffeaea: startup date [Mon Dec 22 12:39:38 AST 2014]; root of context hierarchy
  4. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  5. INFO: Loading XML bean definitions from class path resource [engine.cfg.xml]
  6. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  7. INFO: Loading XML bean definitions from class path resource [jdbc-h2.xml]
  8. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  9. INFO: Loading XML bean definitions from class path resource [bitronix.xml]
  10. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  11. INFO: Loading XML bean definitions from class path resource [datasource.xml]
  12. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  13. INFO: Loading XML bean definitions from class path resource [jndi-setup.xml]
  14. Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  15. INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@36ebce57: defining beans [driverProperties,xaDataSourceClass,driverClass,btm1,btm2,removeBtmFiles,btmConfig,BitronixTransactionManager,bonitaDataSource,bonitaSequenceManagerDataSource,org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,jndiMapping,jndiTemplate,jndiSetup,defineSysprops]; root of factory hierarchy
  16. File 'target/bonita-bt1.tlog' has been successfully deleted
  17. File 'target/bonita-bt2.tlog' has been successfully deleted
  18. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  19. SLF4J: Defaulting to no-operation (NOP) logger implementation
  20. SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  21. Binding java:comp/env/bonitaDS @ a PoolingDataSource containing an XAPool of resource java:comp/env/bonitaDS with 1 connection(s) (1 still available)
  22. Binding java:comp/env/bonitaSequenceManagerDS @ JDBC URL = jdbc:h2:mem:bonita;LOCK_MODE=0;MVCC=TRUE;DB_CLOSE_ON_EXIT=TRUE;IGNORECASE=TRUE;, Username = sa, partitions = 1, max (per partition) = 2, min (per partition) = 1, helper threads = 3, idle max age = 240 min, idle test period = 60 min
  23. Binding java:comp/UserTransaction @ a BitronixTransactionManager with 0 in-flight transaction(s)
  24. Dec 22, 2014 12:39:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  25. INFO: Refreshing org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@6071e6b8: startup date [Mon Dec 22 12:39:42 AST 2014]; root of context hierarchy
  26. Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  27. INFO: Loading XML bean definitions from file ['E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita'\server\platform\conf\sessionaccessor\cfg-bonita-sessionaccessor-threadlocal.xml]
  28. Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  29. INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@37967f35: defining beans [sessionAccessor]; root of factory hierarchy
  30. Dec 22, 2014 12:39:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  31. INFO: Refreshing org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@609ee01b: startup date [Mon Dec 22 12:39:42 AST 2014]; parent: org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@6071e6b8
  32. Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  33.  
  34. etc...

And from the Tomcat Log...

  1. 2014-12-22 12:28:44 org.apache.catalina.core.AprLifecycleListener
  2. INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not fou
  3. nd on the java.library.path: C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Pr
  4. ogram Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Users\Public\Documents\Embarcad
  5. ero\Studio\14.0\Bpl;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
  6. C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;.
  7. 2014-12-22 12:28:44 org.apache.coyote.http11.Http11Protocol
  8. INFO: Initializing Coyote HTTP/1.1 on http-8080
  9. 2014-12-22 12:28:44 org.apache.catalina.startup.Catalina
  10. INFO: Initialization processed in 411 ms
  11. 2014-12-22 12:28:44 bitronix.tm.integration.tomcat55.BTMLifecycleListener
  12. INFO: Starting Bitronix Transaction Manager
  13. 2014-12-22 12:28:44 bitronix.tm.BitronixTransactionManager
  14. INFO: Bitronix Transaction Manager version 2.1.3
  15. 2014-12-22 12:28:44 bitronix.tm.Configuration
  16. INFO: JVM unique ID: <bonita-tomcat-btm-node0>
  17. 2014-12-22 12:28:44 bitronix.tm.resource.ResourceLoader
  18. INFO: reading resources configuration from E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37/conf/bitronix-resources.properties
  19. 2014-12-22 12:28:46 bitronix.tm.recovery.Recoverer
  20. INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 1 resource(s) [jdbc/bonit
  21. aDSXA] (restricted to serverId 'bonita-tomcat-btm-node0')
  22. 2014-12-22 12:28:46 org.apache.catalina.core.StandardService
  23. INFO: Starting service Catalina
  24. 2014-12-22 12:28:46 org.apache.catalina.core.StandardEngine
  25. INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
  26. 2014-12-22 12:28:46 org.apache.catalina.startup.HostConfig
  27. INFO: Deploying configuration descriptor bonita.xml
  28. 2014-12-22 12:28:46 org.springframework.beans.factory.xml.XmlBeanDefinitionReader
  29. INFO: Loading XML bean definitions from file ['E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita'\server\platform\conf\sess
  30. ionaccessor\cfg-bonita-sessionaccessor-threadlocal.xml]
  31. 2014-12-22 12:28:46 org.springframework.beans.factory.support.DefaultListableBeanFactory
  32. INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@33443ac1: def
  33. ining beans [sessionAccessor]; root of factory hierarchy
  34. 2014-12-22 12:28:46 org.springframework.beans.factory.xml.XmlBeanDefinitionReader
  35. INFO: Loading XML bean definitions from file [E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita\server\platform\conf\serv
  36. ices\cfg-bonita-actor-mapping-impl-hibernate.xml]
  37. 2014-12-22 12:28:46 org.springframework.beans.factory.xml.XmlBeanDefinitionReader
  38. INFO: Loading XML bean definitions from file [E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita\server\platform\conf\serv
  39. ices\cfg-bonita-actor-mapping-impl.xml]
  40. 2014-12-22 12:28:47 org.springframework.beans.factory.xml.XmlBeanDefinitionReader
  41. INFO: Loading XML bean definitions from file [E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita\server\platform\conf\serv
  42. ices\cfg-bonita-archive-configuration.xml]

Thanks and regards Seán

No answers yet.
Notifications