Hi,

I have created a java + spring project to run a HumanTask example on Apache Karaf. To instantiate the class, I use spring like this 

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    ">

  <bean id="humanTaskExample" class="org.jbpm.osgi.example.HumanTaskExample"
        init-method="configure"/>

</beans>

public class HumanTaskExample {

    public static void configure() {

        RuntimeManager manager = getRuntimeManager("humantask/HumanTask.bpmn");

...

    private static RuntimeManager getRuntimeManager(String process) {
        // load up the knowledge base
        JBPMHelper.startUp();

...

The JBPMHelper class used corresponds to : https://github.com/droolsjbpm/jbpm/blob/master/jbpm-test/src/main/java/org/jbpm/test/JBPMHelper.java

But when spring creates the dataSource, I get this error :

Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named jdbc/jbpm-ds
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:80)
at org.jbpm.osgi.example.JBPMHelper.setupDataSource(JBPMHelper.java:79)
at org.jbpm.osgi.example.JBPMHelper.startUp(JBPMHelper.java:49)
at org.jbpm.osgi.example.HumanTaskExample.getRuntimeManager(HumanTaskExample.java:88)
at org.jbpm.osgi.example.HumanTaskExample.configure(HumanTaskExample.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_45]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)[91:org.springframework.beans:3.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)[91:org.springframework.beans:3.0.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)[91:org.springframework.beans:3.0.7.RELEASE]
... 14 more
Caused by: java.lang.IllegalArgumentException: resource with uniqueName 'jdbc/jbpm-ds' has already been registered
at bitronix.tm.resource.ResourceRegistrar.register(ResourceRegistrar.java:74)
at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:92)
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:76)

Any idea is welcome

Regards, 

--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com