|Using @Autowired in User Task > On Exit Script to call Spring Service [message #1711600]
||Sun, 18 October 2015 01:28
| Devendra Chaudhari
Registered: October 2015
I have created a BPMN2 process for Order approval using Eclipse BPMN2 Modeller for JBPM 6.2. To keep the process light weight, I have defined the key (Order ID) in the process and rest of the details (Order Name, Create Date, Create User Id, Status etc) are stored in the database.|
There is a user task where the Approver can approve or reject the order. My requirement is to update the status of the order back into the database. For this I tried using @Autowired / @Inject to inject the Spring Service (for updating the status to the DB) into the Exit Script for the User Task. But this does not work and on the server startup, Jboss gives the below error:
23:54:47,290 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runtimeManager' defined in class path resource [META-INF/spring/bean-config/jbpm-application-config.xml]: Cannot resolve reference to bean 'runtimeEnvironment' while setting bean property 'runtimeEnvironment'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runtimeEnvironment': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Cannot add asset: Process Compilation error Autowired cannot be resolved to a type,
I tried importing the Annotation from the Process > Interface > Import but it is not available there for importing.
As an alternate solution I tried using the new operator to create the object for the service, but as the service uses spring DI, it is not able to load the DAO and other dependent classes and gives nullpointer exception while executing the task.
Any help on integrating Spring with Eclipse BPMN2 Modeller for JBPM is highly appreciated.
Powered by FUDForum
. Page generated in 0.16348 seconds