6 Replies Latest reply on Jul 11, 2008 5:10 PM by Mark Torres

    Seam & JBPM

    Cory Dahlstrom Novice

      I'm having trouble with a simple workflow.


      For now, my workflow is pretty simple where I have a start state which transitions to a decision state and then to an end state.


      My problem is when I start the workflow I capture the ID of an entity bean and out-ject that ID ( as a string ) into the 'business process' scope essentially associating my entity with the business process.  The decision state then has an expression method call which then is supposed to use the out-jected ID to determine the next transition.


      However, the ID is not being injected into my stateless session bean even though I can see it via:


      Contexts.getBusinessProcessContext().get(myBeanId )


      Any help would be appreciated.


      Thanks,


      Cory.




        • 1. Re: Seam & JBPM
          Gavin King Master

          Show us the code of the SLSB that is trying to inject myBeanId.

          • 2. Re: Seam & JBPM
            Cory Dahlstrom Novice

            Thanks much for the response.


            I found a similar post which helped me to alleviate the issue, although I'm not sure why.  Here is the post:


            Link to posting


            The same bean that was starting the business process via @CreateProcess was also handling the events from the BPM.  If I separate the BPM handler from the class which starts the process, the injection works as expected.


            Let me know if you still need the code.


            Thanks,


            Cory.

            • 3. Re: Seam & JBPM
              asaf sh Expert


              The same bean that was starting the business process via @CreateProcess was also handling the events from the BPM. If I separate the BPM handler from the class which starts the process, the injection works as expected.


              This is a known issue and was posted by many people,


              Is there any reason for this to happen?
              note: the injection does not occur only for the first time the process tries to invoke a method over the seam component that was created the process with @CreateProcess.




              Asaf.

              • 4. Re: Seam & JBPM
                Tom Goring Apprentice

                I'm getting this problem.


                The bean that started the process when called from an expression in the process definition no injection occurs.


                Should a JIRA be raised ?


                My work around at the moment is to call another seam bean that calls my 'process' bean.



                     <node name="createTempAgentManager">
                          <transition to="sendTempWelcomeEmail">
                               <action expression="#{elFunc.interpolate('agentInviteProcess.createTempAgentManager()')}"></action>          
                          </transition>
                     </node>
                



                Injection does not occur with this example:


                     <node name="createTempAgentManager">
                          <transition to="sendTempWelcomeEmail">
                               <action expression="#{agentInviteProcess.createTempAgentManager()}"></action>          
                          </transition>
                     </node>
                






                • 5. Re: Seam & JBPM
                  Pete Muir Master

                  Can you clearly explain the problem from the beginning?

                  • 6. Re: Seam & JBPM
                    Mark Torres Newbie

                    I think its related to http://www.seamframework.org/Community/BijectionAndJBpmNodeActions. If you're using the same component as a handler to multiple nodes on the bpm, injection happen only on the initial node. I think its because the unproxied bean is stored in the method context, which the succeeding calls use.


                    I posted a solution at the end of this thead, that was working in my case using non-ejb handlers. Is there any drawback to this approach?