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
in components.xml because I am using the full Jboss-server facilities (ejb3).
Hopefully this helps.
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.