cancel
Showing results for 
Search instead for 
Did you mean: 

A lot of trouble regarding OSGi and imports

luecking
Champ in-the-making
Champ in-the-making
Hello,

is there anyone who got the activiti runtime running based on OSGi?

Szenario:
Activiti Engine (Standalone, InMemory-DB) without server all parts should be OSGi bundles

1. org.activiti.osgi bundle
2. my startup bundle
3. the delegate classes bundle

I've a lot of trouble analyzing the missing jars.
fasterxml is not existing, many imports should be optional (server side jars).
Currently I haven't done deeper analyzing, I just spend hours to get it running together with thousands of included jars.

Is there a list of really necessary imports/jars?

Has somebody a running workspace?


Hope that someone can give some hints to get a little bit forward…

regards and thx

Oliver
6 REPLIES 6

luecking
Champ in-the-making
Champ in-the-making
I've seen on the CodeHouse page, that there is a failure regarding spring, drools and fasterxml (they are marked as required instead of optional)

Another question from my side, is it possible to add the runtime as an OSGi feature, so that it can be directly used as a P2 bundle?

luecking
Champ in-the-making
Champ in-the-making
Next step:


Currently analysed necessary jars:
activiti-engine-5.8.jar                  
activiti-osgi-5.8.jar                    
h2-1.2.132.jar                           
mybatis-3.0.4.jar                        
org.apache.felix.configadmin-1.2.8.jar   
org.apache.felix.fileinstall-3.1.10.jar  
org.apache.felix.utils-1.1.0.jar          <– wrong manifest… it will not be shown in the runtime configuration

In the project itself I had to create the jta.jar, same reason as felix.utils.


Now I have the current failures
1) FileInstall package is not available, disabling fileinstall support
    Probably missing some additional felix files ?!?
2) org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource org/activiti/db/mapping/entity/Attachment.xml
    the XML file is part of activiti-engine. I'm not sure if this problem depends on the fileinstall ?!?

luecking
Champ in-the-making
Champ in-the-making
It is running now.

A short how-to:
Build three bundles (OSGi)

1. the Startup-Bundle:
2. the Delegate-Bbundle
3. the Activiti-Engine-Bundle

add these three bundles to runtime-configuration and add "org.eclipse.osgi".
Place the diagram-files into a specific directory to load them



1: Startup-Bundle:
a) import many
org.activiti.engine
and
org.osgi.framework
b) the code of the start method
ProcessEngineConfiguration processEngineConfiguration = StandaloneInMemProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
ClassLoader classLoaderBefore = processEngineConfiguration.getClassLoader();
try {
    processEngineConfiguration.setClassLoader(Thread.currentThread().getContextClassLoader());
} finally {
}   
processEngine = processEngineConfiguration.buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
Deployment deploy = null;
try {
    deploy = repositoryService.createDeployment()
    .addInputStream("TestFlow.bpmn20.xml", new FileInputStream(new File ("d:/diagrams/TestFlow.bpmn20.xml")))
    .addInputStream("TestSubFlow.bpmn20.xml", new FileInputStream(new File ("d:/diagrams/TestSubFlow.bpmn20.xml")))
    .deploy();
} catch (FileNotFoundException e) {
    e.printStackTrace();
}
String procId = runtimeService.startProcessInstanceByKey("TestFlow").getId();


2. Delegate-Bundle
a) import many
org.activiti.engine
and
org.osgi.framework
b) required plugin: activiti-engine-bundle <– give it a nice name 😉
c) add manually
Eclipse-RegisterBuddy: activiti-engine-bundle
to Manifest.MF
d) the code of a delegate class

package com.example.delegate;
import java.util.Map;
public class TestDelegate implements JavaDelegate {
    private FixedValue exampleField = null;
   
    @Override
    public void execute(DelegateExecution de) throws Exception {
    }
    public FixedValue getExampleField() {
        return exampleField;
    }
    public void setExampleField(FixedValue exampleField) {
        this.exampleField = exampleField;
    }
}

3: Activiti-Engine-Bundle:
a) export all packages
b) add manually
Eclipse-BuddyPolicy: registered
to Manifest.MF
c)
Build bundle based on external jars.
Don't extract jar content to bundle.

luecking
Champ in-the-making
Champ in-the-making
added the flows

meyerd
Champ on-the-rise
Champ on-the-rise
Hi Oliver,

Have you had a look at: ACT-1027?

luecking
Champ in-the-making
Champ in-the-making
Have you had a look at: ACT-1027?
Yes, I changed it manually 😉

The problem was that there was no complete list of mandatory jars.
And that the acitivti bundle need a back reference to the delegate-bundle.