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

        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

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:

Trace - Deployaprocessfromabarfile: In
User 'walter.bates' has logged in!
Trace - Deployaprocessfromabarfile: BusinessArchive
Trace - Deployaprocessfromabarfile: ProcessDefinition
Trace - Deployaprocessfromabarfile: ProcessDefinition.id
id8248350021795833151
nameprocess01
version1.0
User 'walter.bates' has logged out!
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:

'bonitaHome = E:\BonitaBPMCommunity-6.3.8-Tomcat-6.0.37\bonita'
Dec 22, 2014 12:39:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6dffeaea: startup date [Mon Dec 22 12:39:38 AST 2014]; root of context hierarchy
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [engine.cfg.xml]
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [jdbc-h2.xml]
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [bitronix.xml]
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [datasource.xml]
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [jndi-setup.xml]
Dec 22, 2014 12:39:39 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
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
File 'target/bonita-bt1.tlog' has been successfully deleted
File 'target/bonita-bt2.tlog' has been successfully deleted
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Binding java:comp/env/bonitaDS @ a PoolingDataSource containing an XAPool of resource java:comp/env/bonitaDS with 1 connection(s) (1 still available)
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
Binding java:comp/UserTransaction @ a BitronixTransactionManager with 0 in-flight transaction(s)
Dec 22, 2014 12:39:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.bonitasoft.engine.service.impl.AbsoluteFileSystemXmlApplicationContext@6071e6b8: startup date [Mon Dec 22 12:39:42 AST 2014]; root of context hierarchy
Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
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]
Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@37967f35: defining beans [sessionAccessor]; root of factory hierarchy
Dec 22, 2014 12:39:42 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
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
Dec 22, 2014 12:39:42 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

etc...

And from the Tomcat Log...

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

Thanks and regards Seán

No answers yet.
Notifications