I'm fairly new to jbpm and I'm trying to run a custom ActionHandler that invokes service-layer beans.
I have two questions:
1. What is the correct way of loading service-layer beans for my ActionHandler and where do I store them?
Right now, my handler looks like this:
I basically package and deploy the applicationContext and service jar along with process definition to JBoss and hope that it finds them.Code:public class OrderLockHandler implements ActionHandler { private static final long serialVersionUID = 1L; private BPMService bpmService = null; private static ApplicationContext applicationContext = null; public void execute(ExecutionContext executionContext) throws Exception { applicationContext = new ClassPathXmlApplicationContext("jbpm-hander-applicationContext.xml"); long orderId = (Long)executionContext.getVariable("orderId"); bpmService = (BPMService)applicationContext.getBean("BPMService"); bpmService.lockOrder(orderId); } }
This sucks in many ways and it doesn't feel right, so I'm hoping there is a correct way of doing this that I don't know.
2. What is the right way of deploying jars to Jboss server?
Currently, I deploy using Eclipse and I'm forced to add service-layer jars as dependencies to the project where my process definition lives, just so it shows up in the deployment window. Is there a better way to deploy jars to Jboss server?
I tried copying them to server/lib folder, but when I do that, it throws an exception "Cannot cast OrderLockHandler to ActionHandler"
I would appreciate any guidance in my jbpm journey here. Thanks
What I run on:
JBoss 4.2.2 GA
jbpm-jpdl-3.2.3
spring-modules-jbpm31 v0.8-20070311155753


