4 Replies Latest reply on Dec 26, 2007 4:22 PM by mschmidke

    Seam 2.0.CR1, jBPM and custom entity process variables

    mschmidke

      Hello all,

      now that I've understood how to bootstrap Seam's jBPM support, I'm immediately facing the next problem.

      The root of the problem is that I want to use my own EJB3 entites as jBPM process variables. I've done some research before, because this is not very well documented yet, but finally I was successful.

      But now I fear that my way how to use jBPM interferes with Seam's way how to support jBPM.

      What I have done with respect to jBPM:

      - in my own persistence.xml, I reference jBPM's hibernate.cfg.xml so that my EntityManager knows about jBPM's entity
      - in the same file, I tell Hibernate to register a Session Factory in JNDI
      - in jbpm.cfg.xml I tell jBPM to use a JtaDbPersistenceServiceFactory, referencing my Hibernate Session Factory JNDI name
      - in every JbpmContext I create, I inject a Hibernate Session from my EJB3 EntityManager (jbpmContext.setSession()).

      The result is that jBPM uses the EJB3 entity manager for it's work, and there is absolutely no problem in mixing jBPM entities and my own entities, for example as process variables.

      Now the point where Seam comes into play. Since Seam has some support for jBPM, I wanted to try it, but was unsuccessful. I configured:

      <bpm:jbpm>
       <bpm:process-definitions>
       <value>Argos3Freigabeprozess/processdefinition.xml</value>
       </bpm:process-definitions>
      </bpm:jbpm>
      


      , but on startup I get:

      09:17:28,787 ERROR [[/Argos3Web]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      java.lang.RuntimeException: could not deploy a process definition
      [...]
      Caused by: org.hibernate.TransactionException: Could not register synchronization for container transaction
      at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45)


      I am accustomed to this error message; it usually shows up if I forget to inject the Hibernate Session into a jBPM context. This tells me that my way of configuring jBPM is not compatible with Seam's way of using jBPM.


      Any ideas??


      Marcus.

        • 1. Re: Seam 2.0.CR1, jBPM and custom entity process variables
          pmuir

          Do you still need help with this? Sorry, I lost track of the issue.

          • 2. Re: Seam 2.0.CR1, jBPM and custom entity process variables
            mschmidke

             

            "pete.muir@jboss.org" wrote:
            Do you still need help with this? Sorry, I lost track of the issue.


            Yes and no ...I get perfectly along when I do it without Seam's jBPM support, but of course this is a pity because I want to get the best out of Seam.

            To abstract my problem:

            When I began my project, I spent two or three days getting jBPM and EJB3 together such that I can reference EJB3 entity beans as jBPM process variables. This wasn't ready documented, but I managed it.

            A few weeks later I tried to get Seam into this, but had no success, because Seam wasn't compatible to the way I injected my Persistence Context's Hibernate Session into jBPM (for that jBPM uses Persistence Context's transaction scope which is finally a Seam managed transaction).

            I am not sure whether I am doing something wrong or whether this is a feature request.

            Did you ever interweave jBPM and EJB3?

            Happy Holidays,

            Marcus.

            • 3. Re: Seam 2.0.CR1, jBPM and custom entity process variables
              pmuir

              Normally when you use Seam with jbpm and want process variables you would use Seam's business process scope (which is not the same thing).

              We haven't tried using process variables that are JPA entities with Seam, so I guess if you file a JIRA request with a runnable test case we can take a look...

              • 4. Re: Seam 2.0.CR1, jBPM and custom entity process variables
                mschmidke

                 

                "pete.muir@jboss.org" wrote:
                Normally when you use Seam with jbpm and want process variables you would use Seam's business process scope (which is not the same thing).


                Yes ... I really did not try this ... but I cannot imagine what the result would be ... I do not really like byte array process variables containing serialized data because we want to be able to look with third party software at the data.

                I'll file an issue when I am back in office next week.

                Marcus.