cancel
Showing results for 
Search instead for 
Did you mean: 

Minimal Activiti engine for use on Android

hybridmojo
Champ in-the-making
Champ in-the-making
Hi folks,

I wanted to get an idea of the size and components that would make up a minimal project using Activiti so I can try to deploy it on Android.  I tried using jBoss jBpm but unfortunately to do even basic tasks like loading a bpmn file, jBpm has rather extensive dependencies on drools.  Drools doesn't work well on Android because it compiles bytecode at runtime which is incompatible w/ Android's Dalvik bytecode.  If all you need to do is define a process using the jBPM process API, without any custom nodes, it's pretty smooth, but I really do not want to define my processes using java (or I wouldn't use a workflow engine at all!).

My application is not particularly complex– mostly, I just need to loop running some custom java code which grabs some data until certain conditions are met, at which time another custom tasks is called.  It gets trickier because several of these loops need to run in parallel and the full process diagram, drawn out in powerpoint, is about 15 pages long.  This could be done without a workflow engine, I suppose, but it sounds like an absolutely awful mess to maintain.
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
What kind of functionality would you need from Activiti?
Do note that a jdbc database is required for Activiti, I don't know how that will work on Android.

hybridmojo
Champ in-the-making
Champ in-the-making
JBarrez,

Android has a SQLLite DB built in, but this lacks a JDBC driver.  Darn.

Looks like I'll have to do it server side.

hybridmojo
Champ in-the-making
Champ in-the-making

jbarrez
Star Contributor
Star Contributor
Cool (from a tech point of view ;-)!

hybridmojo
Champ in-the-making
Champ in-the-making
So I tried creating a basic project and adding the activiti engine libs plus sqldroid.

// Register SQLite JDBC driver
Class.forName("org.sqldroid.SQLDroidDriver").newInstance();

// Get process engine
ProcessEngines.init();
       
// Load cfg file
InputStream cfg_is;
cfg_is = getResources().getAssets().open("activiti.cfg.xml");

// Use cfg file to create a process engine
ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(cfg_is).buildProcessEngine();

RuntimeService runtimeService = processEngine.getRuntimeService();
    
Map<String,Object> variables = new HashMap<String,Object>();
variables.put("test", "test");
    
// may need to deploy
runtimeService.startProcessInstanceByKey("setScriptResultToProcessVariable", variables); 
    
// Shut down
ProcessEngines.destroy();

Well the code gets to processEngine.getRuntimeService(); and then barfs with an unhelfpul Android error. 

The useful bit of the stacktrace is:
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from resource loaded through InputStream; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl@4057c940] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.

I assume the XML Schema is being used for validation, is there a way to turn this off?


Full stack trace follows:

02-02 19:38:44.976: E/AndroidRuntime(27945): FATAL EXCEPTION: main
02-02 19:38:44.976: E/AndroidRuntime(27945): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hybridmojo.sample.activi/com.hybridmojo.sample.activi.ActivitiSampleActivity}: org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from resource loaded through InputStream; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl@4057c940] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1821)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread.access$1500(ActivityThread.java:132)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.os.Looper.loop(Looper.java:143)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread.main(ActivityThread.java:4263)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at java.lang.reflect.Method.invokeNative(Native Method)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at java.lang.reflect.Method.invoke(Method.java:507)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at dalvik.system.NativeStart.main(Native Method)
02-02 19:38:44.976: E/AndroidRuntime(27945): Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from resource loaded through InputStream; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl@4057c940] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.activiti.engine.impl.cfg.BeansConfigurationHelper.parseProcessEngineConfiguration(BeansConfigurationHelper.java:35)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.activiti.engine.impl.cfg.BeansConfigurationHelper.parseProcessEngineConfigurationFromInputStream(BeansConfigurationHelper.java:43)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.activiti.engine.ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(ProcessEngineConfiguration.java:163)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.activiti.engine.ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(ProcessEngineConfiguration.java:159)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at com.hybridmojo.sample.activi.ActivitiSampleActivity.onCreate(ActivitiSampleActivity.java:50)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
02-02 19:38:44.976: E/AndroidRuntime(27945):  … 11 more
02-02 19:38:44.976: E/AndroidRuntime(27945): Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl@4057c940] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:102)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
02-02 19:38:44.976: E/AndroidRuntime(27945):  … 20 more
02-02 19:38:44.976: E/AndroidRuntime(27945): Caused by: java.lang.IllegalArgumentException: http://java.sun.com/xml/jaxp/properties/schemaLanguage
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:86)
02-02 19:38:44.976: E/AndroidRuntime(27945):  at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(Def