2 Replies Latest reply on Sep 10, 2009 11:27 AM by almarro1.almarro1.gmail.com

    Seam + jbpm + webservices

    almarro1.almarro1.gmail.com

      I'm trying to implement a webservice that receives a data sample and passes it to a data manager, which first persist it into the database, and then raises an event.
      Another component is listening to that event and calls a method annotated with @CreateProcess in order to start a new business process instance of a currently deployed process definition.


      If I call the method annotated with @CreateProcess from any compoment deployed in seam, everyting works fine and the process is created successfully.


      However, when raising the event from the webservice bean (I've tried both synchronous and asynchronous event invocation), when the method with the @CreateProcess is invoked, the interceptor BusinessProcessInterceptor is not executed, so the process instance is not created.


      Why is it happening?


      Another thing that annoys me is the fact that JBoss is logging a warning message that says:


      WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container


      which maybe the problem why the BusinessProcessInterceptor is not been executed.


      Does anyone know how to make that interceptor work from the webservice invocation?


      Thanks in advance.

        • 1. Re: Seam + jbpm + webservices
          lvdberg

          I am using RestEasy for a similar job. It took some time to figure out the right scoping of the beans.


          I use a stateless bean to do all the validation/persisting of data and triggering the workflow via an event. The Rest-service is used as front-end to interact with the external system. I found out that the most important setting for Rest is making it a SESSIOn-scoped bean. Although this seems a bit tricky, Seam uses a bit different approach for the service; the session exists no longer than necessary to handle the full request. I also used



          <transaction:ejb-transaction  />

          in components.xml because  I am using the full Jboss-server facilities (ejb3).



          Hopefully this helps.


          Leo






          • 2. Re: Seam + jbpm + webservices
            almarro1.almarro1.gmail.com

            Hi Leo, thanks for your quick response.
            Unfortunatelly, the use of Stateful ejbs to deploy webservices creates much more trouble than I would like. I have no choice rather than use stateless ones.


            In the meantime, I think I've found a solution for my problem.
            First of all, I've rewriten the webservice component to be just a facade for the component performing the real busines logic.
            Second, I have added a persistence configuration section under 'components.xml' in the jbpm project. The resulting configuration looks like this:


            <persistence:hibernate-session-factory name="WHFProcessSessionFactory" 
                  auto-create="true" cfg-resource-name="hibernate.cfg.xml"/>
            <persistence:managed-hibernate-session name="WHFjbpmSession" 
                  auto-create="true" session-factory-jndi-name="java:/WHFProcessSessionFactory"/>



            With these two changes, everything is working fine now.


            Thanks again.


            Alvaro