11 Replies Latest reply on Apr 27, 2009 7:36 AM by heiko.braun

    Beginner question: Using jBPM from EJB application

    jarppe

      Hello,

      I have tested jBPM in standalone J2SE application to get familiar with it's API. I have configured JBoss and jBPM and successfully deployed the jbpm-enterprise.ear.

      How ever, now I'm not sure how to develop EJB application that would use jBPM deployed in my JBoss container? Does jbpm-enterpeice.ear provide a session bean with jBPM functionality that I could use, or should I use the JbpmCommandQueue and send commands to it, or what?

      --
      -jarppe

        • 1. Re: Beginner question: Using jBPM from EJB application
          salaboy21

          Yeap! jbpm-entreprise provide a Stateless session bean called CommandServiceBean that provide what you are looking for!

          I hope it helps

          • 2. Re: Beginner question: Using jBPM from EJB application

            Hello Jarppe,

            Can ypu please list down the steps that I need to follow to access jBPM from an external standalone program. I am getting the following error:

            log4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
            log4j:WARN Please initialize the log4j system properly.
            Exception in thread "main" org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'D:\eclipse_new\eclipse-SDK-3.4.1-win32\eclipse\workspace\TestEvenNumberjDPL\src\lib\jbpm.cfg.xml'
            at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:292)
            at EvenNumbersTest.main(EvenNumbersTest.java:15)
            Caused by: org.jbpm.JbpmException: jbpm configuration resource 'D:\eclipse_new\eclipse-SDK-3.4.1-win32\eclipse\workspace\TestEvenNumberjDPL\src\lib\jbpm.cfg.xml' is not available
            at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:286)
            ... 1 more

            I am not sure what I am missing. Any help will be greatly appreciated.

            Regards,
            Ruchika

            • 3. Re: Beginner question: Using jBPM from EJB application
              kukeltje

              ruchika,

              Please not so many duplicate posts, you achieve the opposite, people will start ignoring it.

              • 4. Re: Beginner question: Using jBPM from EJB application

                I understand that but I am not getting this issue solved. I am searching and when getting relevant post, I asking for help. I am able to access this process from JUnit and standalone class from within the JBPM project but from external project I am not able to access the process.
                I tried what you suggested (setting the classpath) but things are not happening.
                Can you please suggest me how to progress and what mistake I am doing?

                Help and guidance will be greatly appreciated.

                Regards,
                Ruchika

                • 5. Re: Beginner question: Using jBPM from EJB application
                  kukeltje

                  I understand, but asking the same thing in multiple topics is counterproductive. For you and for others in the future. What you at least should do is be more specific. On which system do you get this error? The server or the client? How is the setup (project in eclipse, server running somewhere else etc...) It might be that you already described this (though I doubt that I misssed it) but also due to the fragmentation of your question it might that I have.

                  • 6. Re: Beginner question: Using jBPM from EJB application

                    Thanks Ronald for replying and giving me these tips.
                    Let me expalin you the whole scenario:

                    I am using eclipse 3.4 and jpdl version3.2.3(jbpm-jpdl-3.2.3)
                    I have developed jbpm project and process definition using eclipse.
                    Now I wrote JUnit test case and standalone program within this project itself(jbpm project). I am able to see result in console(I have not developed any UI, not my projects requirement).

                    Now I have created a java project (not jbpm).
                    Requirement: In this project I want to call the bussiness process created above.
                    Steps done:
                    1. In java project written a main class having code for invoking bussiness process created above.
                    2. Included jbpm.cfg.xml in classpath as suggested by you but getting below error:

                    log4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
                    log4j:WARN Please initialize the log4j system properly.
                    Exception in thread "main" org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'jbpm.cfg.xml'
                    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:292)
                    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:257)
                    at org.jbpm.JbpmConfiguration$Configs.getObjectFactory(JbpmConfiguration.java:425)
                    at org.jbpm.JbpmConfiguration$Configs.getObject(JbpmConfiguration.java:437)
                    at org.jbpm.JbpmConfiguration$Configs.getString(JbpmConfiguration.java:441)
                    at org.jbpm.graph.def.ProcessDefinition.createNewProcessDefinition(ProcessDefinition.java:97)
                    at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:138)
                    at org.jbpm.graph.def.ProcessDefinition.parseXmlInputStream(ProcessDefinition.java:179)
                    at org.jbpm.graph.def.ProcessDefinition.parseXmlResource(ProcessDefinition.java:160)
                    at com.test.EvenNumbersTest.main(EvenNumbersTest.java:31)
                    Caused by: org.jbpm.JbpmException: jbpm configuration resource 'jbpm.cfg.xml' is not available
                    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:286)
                    ... 9 more

                    Then I added the lines:
                    1. JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance("D:\\eclipse_new\\eclipse-SDK-3.4.1-win32\\eclipse\\workspace\\TestEvenNumberjDPL\\lib\\jbpm.cfg.xml");

                    2. JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();

                    I am now getting the following error:

                    log4j:WARN No appenders could be found for logger (org.jbpm.JbpmConfiguration).
                    log4j:WARN Please initialize the log4j system properly.
                    Exception in thread "main" org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'D:\eclipse_new\eclipse-SDK-3.4.1-win32\eclipse\workspace\TestEvenNumberjDPL\src\lib\jbpm.cfg.xml'
                    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:292)
                    at EvenNumbersTest.main(EvenNumbersTest.java:15)
                    Caused by: org.jbpm.JbpmException: jbpm configuration resource 'D:\eclipse_new\eclipse-SDK-3.4.1-win32\eclipse\workspace\TestEvenNumberjDPL\src\lib\jbpm.cfg.xml' is not available
                    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:286)
                    ... 1 more

                    I am not sure what I am missing. I have searched lot but not getting any clue what is going wrong. Please help.
                    Do I need to refer the jbpm project in my java project?
                    I am clueless.

                    Regards,
                    Ruchika

                    • 7. Re: Beginner question: Using jBPM from EJB application
                      kukeltje

                      the location in the error and the location you tell the code to load the jbpm.cfg.xml are different. One contains src, one doesn't. Do you run the test also from eclipse?

                      • 8. Re: Beginner question: Using jBPM from EJB application

                        Code one is the typo mistake.
                        Yes I am running from eclipse

                        Regards,
                        Ruchika

                        • 9. Re: Beginner question: Using jBPM from EJB application
                          kukeltje

                          I have no clue... can you mail me the eclipse project as a zip? ronald (dot) jbpm (at) org, but switch the dot and at ;-)

                          • 10. Re: Beginner question: Using jBPM from EJB application

                            hi Ruchika

                            i am facing same problem. did u get the solution if yes pls let me know

                            • 11. Re: Beginner question: Using jBPM from EJB application
                              heiko.braun

                              In jbpm4 you can lookup java:/ProcessEngine from an EJB