0 Replies Latest reply on Dec 28, 2011 1:20 PM by Paul Werder

    Using JBoss 7 datasource in jBPM5.2

    Paul Werder Newbie

      Hi all JBPM users,

      I'd need to prepare a demo jbpm 5 application so that I can convince the management staff to use it :-)

      I've found a sample demo application on bpmn2's blog which uses jBPM5.2 features to start a process, in the same JVM as the TaskService:


      try {
      DeleteDbFiles.execute("", "JPADroolsFlow", true);
      Server h2Server = Server.createTcpServer(new String[0]);
      } catch (SQLException e) {
      throw new RuntimeException("can't start h2 server db",e);
      try {
      UserTransaction ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );


      PoolingDataSource ds1 = new PoolingDataSource();

      ds1.getDriverProperties().setProperty("driverClassName", "org.h2.Driver");
      ds1.getDriverProperties().setProperty("url", "jdbc:h2:tcp://localhost/JPADroolsFlow");
      ds1.getDriverProperties().setProperty("user", "sa");
      ds1.getDriverProperties().setProperty("password", "");
          System.setProperty("jbpm.usergroup.callback", "org.jbpm.task.service.DefaultUserGroupCallbackImpl");
         EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
          StatefulKnowledgeSession ksession = JbpmAPIUtil.createKnowledgeSession("HelloProcess.bpmn",emf);

      That would be perfect, except that it uses a PollingDatasource for the example- I'd rather need to connect to JBoss 7 datasource, or at least use Hibernate configuration file to define the connection properties. Can anybody suggest me how to modify this example ???

      Thanks a lot