Hi,
I'm developing an Activiti-based and I've run into the same kind of class-loading issues like those you described. In order to avoid them, I've adopted the following "doctrine":
* Process artifacts (.bar/.bpmn20.xml) never pack java classes
* Service tasks always use the "actitivi:expression" (a delegate expression would work fine). Something like that: activiti:expression="${scriptRunner.execute('myscript.groovy',execution)}"
* Form and process variables only use primitive data types. Anything else type is JSONified before being put into the process context.
* Service task scripts always access backend systems through REST and/or SOAP services, preferably by means of an ESB.
This doctrine works for me because I use Activiti Explorer as a monitoring/admin tool, while all user interaction occurs in a custom-made front-end. Other benefits from this approach are:
* Forms and scripts can be changed without any change in the process itself, without any restart
* Form, script and process development can be assigned to different team members, and each one can push their changes independently (within certain limits, of course) from each other.
You may ask why didn't I use the script task for this, but I did not find a way to externalize scripts with this kind of activity - but I admit I did not try very much.