1 2 Previous Next 27 Replies Latest reply on Jul 22, 2009 6:34 PM by Ronald van Kuijk

    About integrating JBPM in an existing EAR

    Kerdudou Ronan Apprentice


      Hi all,

      We are looking for some BPM solution and specifically looking at jBPM.
      We are developing an ear (web app + Stateless session EJB + hibernate).

      jBPM seems promising but we have some questions about the integration in our application:

      - Is there potential problems between our hibernate config and jBPM's one ? (Is there some concerns we should care about hibernate ?)

      - Is jBPM MS-SQL compatible ? (Our application is used with microsoft's DB)

      - Is it better to provide jBPM is own DB schema or should it use the schema of our app ? (I think about ACID transaction concern but also maintainability )

      Thanks for any answer.


        • 1. Re: About integrating JBPM in an existing EAR
          Ronald van Kuijk Master

          1: Not more normally. Just take the transactions etc into account.

          2: There have been reports of it working, though JBoss does not officially support it (it is not in their qa run). That does not mean you should not try, It just can be that you have some small issues which can probably be easily solved (it is hibernate based)

          3: Own schema needs XA datasoure afaik (no db expert) and shared schema does not. But both should work if the driver/db fully supports XA

          • 2. Re: About integrating JBPM in an existing EAR
            Shekhar Vemuri Newbie

            Our implementations have the jbpm tables in it's own schema and the application tables in a different one, You do not require XA for that.
            If you had the schemas in two different databases then you would need XA.

            • 3. Re: About integrating JBPM in an existing EAR
              Shekhar Vemuri Newbie

              As for the MS-SQL compatibility problems, I have used v3.2.6SP1 against MS-SQL, and did not find any problems.

              But then I have not used it in PROD. But having said that, with Hibernate in place, the risk associated with using it against MS-SQL would be relatively lower, but again something that you do have to account for, and as Ronald mentioned below, it will not be anything major(if any).

              • 4. Re: About integrating JBPM in an existing EAR
                Ronald van Kuijk Master

                "Not anything major"... Shhhtttt but don't tell that to Alejandro.... the db guru of the project... Sybase and DB2 had their fair share of issues which he solved but there were some complications.

                • 5. Re: About integrating JBPM in an existing EAR
                  Shekhar Vemuri Newbie

                  :)
                  I was only referring to MS-SQL! We were staging in MS SQL for quite some while, before we got our Oracle instance commissioned, and we did not have any problems,

                  But then,yes you will have to deal with anything if it came up,

                  • 6. Re: About integrating JBPM in an existing EAR
                    Ronald van Kuijk Master

                    Iǘe heard that not all dbms support unsing non xa when using 2 schema's. but then again, dbms is not my cup of tea so I'll believe anything they tell me

                    • 7. Re: About integrating JBPM in an existing EAR
                      Kerdudou Ronan Apprentice

                      Thanks a lot for your answers,

                      I'll certainly be back for other newbie questions

                      • 8. Re: About integrating JBPM in an existing EAR
                        Kerdudou Ronan Apprentice

                        I think we should add jBPM table in our schema.

                        I guess it makes thing simplier (only one DB config)

                        but ...
                        I saw in jbpm4 developper guide "3.2. Known limitations" :

                        User provided transasctional resources such as JDBC connections or hibernate connections


                        Does it means that I can't inject my hibernate session ?

                        Is there a way with jBPM4 to configure it without its own hibernate config file ?


                        • 9. Re: About integrating JBPM in an existing EAR
                          Ronald van Kuijk Master

                          I think there is no reason to not be able to create just one hibernate config file with everything in it. Just give it a try.

                          • 10. Re: About integrating JBPM in an existing EAR
                            Kerdudou Ronan Apprentice

                            I'm giving a try but it is not easy as it seems for a newbie.

                            First of all, I can't find a real doc on all the config files (required or optional values, different properties ...) and I guess they are based on a IOC pattern but as I don't know what is required my test failed with a NullpointerException:

                            java.lang.NullPointerException
                             at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(DeploymentImpl.java:89)
                             at com.vc.mm.jbpm.JbpmTest.testHelloWorld(JbpmTest.java:35)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



                            I guess "CommandService" is not injected in "RepositoryServiceImpl" but why ?

                            Here it is my jbpm.cfg.xml:

                            <?xml version="1.0" encoding="UTF-8"?>
                            <jbpm-configuration>
                            
                             <!-- import resource="jbpm.default.cfg.xml" / -->
                             <!-- import resource="jbpm.tx.hibernate.cfg.xml" / -->
                            
                             <!-- from jbpm.default.cfg.xml -->
                             <process-engine-context>
                            
                             <repository-service />
                             <repository-cache />
                             <execution-service />
                             <history-service />
                             <management-service />
                             <identity-service />
                             <task-service />
                            
                             <!-- change here : no hibernate config for jbpm -->
                             <!-- hibernate-configuration>
                             <cfg resource="jbpm.hibernate.cfg.xml" />
                             </hibernate-configuration -->
                            
                             <!-- change here : no hibernate session factory for jbpm -->
                             <!-- hibernate-session-factory / -->
                            
                             <script-manager default-expression-language="juel"
                             default-script-language="juel">
                             <script-language name="juel"
                             factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
                             </script-manager>
                            
                             <authentication />
                            
                             <id-generator />
                             <types resource="jbpm.variable.types.xml" />
                            
                             <address-resolver />
                            
                             <business-calendar>
                             <monday hours="9:00-12:00 and 12:30-17:00" />
                             <tuesday hours="9:00-12:00 and 12:30-17:00" />
                             <wednesday hours="9:00-12:00 and 12:30-17:00" />
                             <thursday hours="9:00-12:00 and 12:30-17:00" />
                             <friday hours="9:00-12:00 and 12:30-17:00" />
                             <holiday period="01/07/2008 - 31/08/2008" />
                             </business-calendar>
                            
                             <mail-template name='task-notification'>
                             <to users="${task.assignee}" />
                             <subject>${task.name}</subject>
                             <text><![CDATA[Hi ${task.assignee},
                            Task "${task.name}" has been assigned to you.
                            ${task.description}
                            
                            Sent by JBoss jBPM
                            ]]></text>
                             </mail-template>
                            
                             <mail-template name='task-reminder'>
                             <to users="${task.assignee}" />
                             <subject>${task.name}</subject>
                             <text><![CDATA[Hey ${task.assignee},
                            Do not forget about task "${task.name}".
                            ${task.description}
                            
                            Sent by JBoss jBPM
                            ]]></text>
                             </mail-template>
                            
                             </process-engine-context>
                            
                             <transaction-context>
                             <repository-session />
                             <db-session />
                            
                             <message-session />
                             <timer-session />
                             <history-session />
                             <mail-session>
                             <mail-server>
                             <session-properties resource="jbpm.mail.properties" />
                             </mail-server>
                             </mail-session>
                             </transaction-context>
                            
                             <!-- change here : from jbpm.tx.hibernate.cfg.xml -->
                             <process-engine-context>
                             <command-service>
                             <retry-interceptor />
                             <environment-interceptor />
                             <standard-transaction-interceptor />
                             </command-service>
                             </process-engine-context>
                            
                             <transaction-context>
                             <transaction />
                             <!-- change here : added => current="true"-->
                             <hibernate-session current="true" />
                             </transaction-context>
                            
                             <import resource="jbpm.jpdl.cfg.xml" />
                             <import resource="jbpm.identity.cfg.xml" />
                             <import resource="jbpm.jobexecutor.cfg.xml" />
                            
                            </jbpm-configuration>
                            


                            Thanks for any hint.



                            • 11. Re: About integrating JBPM in an existing EAR
                              Kerdudou Ronan Apprentice


                              I can't achieve to inject my own hibernate config.

                              jBPM4 always want to initialize its own hibernate SessionFactory.

                              Notices I don't use 'Spring'.

                              Any help would be greatly appreciated

                              • 12. Re: About integrating JBPM in an existing EAR
                                Shekhar Vemuri Newbie

                                This actually might be a problem,
                                I had to jump through a bunch of hoops to get this working.

                                Let me get together a test case and I will post it on the forum for the Design team to look at.

                                I have a small application that integrates with hibernate and also with your custom hbm files, exactly the way you need, was part of a blog post I was planning on writing.

                                You can refer to that, I will be posting that over the weekend.

                                • 14. Re: About integrating JBPM in an existing EAR
                                  Shekhar Vemuri Newbie

                                  Actually,

                                  I will get the code sample going today or so, but just so that you are not held up, here's how you would do it.

                                  You initialize the Jbpmconfiguration object,

                                   //Setup the SessionFactory, this would be in your control.
                                   //I am using the HibernateUtil approach, that is pretty well documented
                                   //on the Hibernate site.
                                   SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
                                   JbpmConfiguration configuration = new JbpmConfiguration();
                                  
                                   //Substitute this with however you want to get a handle to the config
                                   //file.
                                   String jbpmConfigResource = "your_app.jbpm.cfg.xml";
                                   if (jbpmCfgResource != null) {
                                   configuration.setResource(jbpmTestCfgResource);
                                   configuration.setSessionFactory(sessionFactory);
                                   }
                                  

                                  Once you do the above, you should have the code going such that Hibernate uses your sessionFactory to interact with the database.

                                  1 2 Previous Next