cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti + osgi

bhj2
Champ in-the-making
Champ in-the-making
Does anybody already use activiti with OSGI? Was it a good experience?

Best regards!
30 REPLIES 30

jupi
Champ in-the-making
Champ in-the-making
I use Felix and activiti version 5.7.
I couldn't use groovy scripts in osgi environment.

Caused by: org.activiti.engine.ActivitiException: Can't find scripting engine for 'groovy'
        at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:66)
        at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:43)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)

So i had to fall back to use javascript for scripting of ScriptTasks, although the groovy bundle was started. This was only a minor issue.

More important is that the classes of my bundle or classes from other bundles could not be reached by scripts of my processes.
I wonder if I could somehow specify the class loader of the scripting environment.

Is anybody there who could solve these issues?

trademak
Star Contributor
Star Contributor
Hi,

I'll be working with the OSGi implementation for the Activiti in Action book in the next days.
Note however that the Activiti OSGi module is mainly tested with Apache Karaf.
And that's what I'll be using for Activiti in Action.
But of course it should also be possible to get it running on Felix.

Best regards,

bhj2
Champ in-the-making
Champ in-the-making
Hi,

I made some first steps in testing this. So the projects you uploaded are fine for me to test.
However I need some more time to investigate this. I'll come back to this in a couple of days.

Best regards,

And do you have the same exceptions?! Any progress?

jupi
Champ in-the-making
Champ in-the-making
More important is that the classes of my bundle or classes from other bundles could not be reached by scripts of my processes.
I wonder if I could somehow specify the class loader of the scripting environment.

I managed to get around this problem by passing an object (actually a service locator) as a variable to the process.

bhj2
Champ in-the-making
Champ in-the-making
Hi,

I'll be working with the OSGi implementation for the Activiti in Action book in the next days.
Note however that the Activiti OSGi module is mainly tested with Apache Karaf.
And that's what I'll be using for Activiti in Action.
But of course it should also be possible to get it running on Felix.

Best regards,

Other question, what about the Activiti in Action book and this OSGI part? When is it going to be published? What will be the content? Will you write about the possibility to add the JavaDelegate classes in OSGI bundles at runtime?

Best regards

trademak
Star Contributor
Star Contributor
Hi,

I've not been able to work on this as much as I would have liked, but I've made some progress.
I still have to do some work on separating the JavaDelegate classes in separate bundles, so I didn't run into problems yet.

In the Activiti in Action book we'll discuss how to implement Activiti in Apache Karaf and that you can separate the process XML from the Java classes by using different bundles. This will also show hot deployment of a new version of the Java class bundle. The Activiti in Action book is already available in MEAP (which means that chapters will become available during writing). I've made quite some progress in the last weeks and we've 11/15 chapters written already. So I expect that the chapters should be ready in 1,5 month or so. Then the production process @ Manning will start, which also takes around 2 months.

Best regards,

trademak
Star Contributor
Star Contributor
Hi,

I've an OSGi example working on Apache Karaf. There are a number of pitfalls that I encountered while implementing the examples.
But you find the source code at the Activiti in Action google code repository: http://code.google.com/p/activitiinaction/ in the book-osgi-app project.

Best regards,

bhj2
Champ in-the-making
Champ in-the-making
Hi,

I've an OSGi example working on Apache Karaf. There are a number of pitfalls that I encountered while implementing the examples.
But you find the source code at the Activiti in Action google code repository: http://code.google.com/p/activitiinaction/ in the book-osgi-app project.

Best regards,

Thank a lot. I didn't look at the code yet but it sounds very interesting!

About the Activiti in action book, we only found the 7 first chapters in MEAP. Arn't the chapters 8-11 available yet?

Best regards!

trademak
Star Contributor
Star Contributor
Hi,

There's a big update coming up for the Activiti in Action MEAP, which includes a rewrite of all chapters to Activiti 5.7 and the addition of chapter 11 + 12 (ESB and Rules).
We are working very hard on the remaining chapters, so you can expect new chapters arriving very soon.

Best regards,

kaech
Champ in-the-making
Champ in-the-making
More important is that the classes of my bundle or classes from other bundles could not be reached by scripts of my processes.
I wonder if I could somehow specify the class loader of the scripting environment.

I have the same problem using the OSGi-Activiti bundle from the Activiti in action book. Activiti is running a simple process including a ScriptTask. The ScriptTask does:

def customer = new org.mytypes.Customer();

At runtime GroovyScriptEngineImpl.eval it complains that the Customer class can not be found.

Using a ServiceLocator might be an option to solve the problem, although it would be nicer if Activiti could resolve and create the types without such an intermediary.

Another option would be a dynamic import on the Groovy-OSGI-bundle, but this doesn't seem to be a good idea cause it weakens the strict class loading mechanism in OSGi.

What would be the best way to provide the custom types to Activiti?
Suggestions would be welcome.