Problem in adding Action classNaseem Khan May 9, 2007 6:02 AM
Hi,
I am facing problem in executing a custom action class in jbpm 3.1
Process is something like this...
start--->state1-->end1
Now at state1, I have a action class at the time of node-enter.
<state name="state1"> <event type="node-enter"> <action name="action1" class="com.sample.action.MessageActionHandler"> <message>NASEEM</message> </action> </event> <transition name="action is executed" to="end1"> </transition> </state>
My MessageActionHandler class...
package com.sample.action; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; public class MessageActionHandler implements ActionHandler { private static final long serialVersionUID = 1L; /** * The message member gets its value from the configuration in the * processdefinition. The value is injected directly by the engine. */ String message; /** * A message process variable is assigned the value of the message * member. The process variable is created if it doesn't exist yet. */ public void execute(ExecutionContext context) throws Exception { System.out.println("*************************************************************************"); //context.getContextInstance().setVariable("message", message); //System.out.println("Message is>>>>>>>>>>>>> " + message); } }
On the server console... I get this message...
.......
DEBUG [GraphElement] event 'node-enter' on 'State(state1)' for 'Token(/)'
DEBUG [GraphElement] executing action 'action[action1]'
.......
But my action class execute method is not executed?
My Action class is in the process project and I have selected java classes and resources. I deployed process definition on server-deployer /jbpm/upload
My Action class is not in the jbpm.war. I am not sure where I should put my Action class.
Please help me in this regard
Thanks in advance
Naseem
1. Re: Problem in adding Action classRonald van Kuijk May 9, 2007 6:58 AM (in response to Naseem Khan)
how do you know it is not executed? Isn't your system.out going somewhere else?
What happens if you rename the execute method to execute1?
2. Re: Problem in adding Action classNaseem Khan May 9, 2007 3:38 PM (in response to Naseem Khan)
Well if that execute method is executed... then sop line should be printed on the jboss server console.
I checked jboss server console and there is no output: ***********
Now I did one more thing.. I included my process definition as well as its action in jbpm war file... this time it worked. I am able to see the output on the console.
3. Re: Problem in adding Action classRonald van Kuijk May 10, 2007 7:05 AM (in response to Naseem Khan)
I've seen situations where the stdout was not on the jboss 'console' that's why I asked. I should have been more explicit, sorry.
What do you mean by including the pd and action in the war? Or stated in another way, how did you deploy them before this
4. Re: Problem in adding Action classNaseem Khan May 10, 2007 7:55 AM (in response to Naseem Khan)
Now I moved my process definition plus action class in jbpm project. Action class is in src/java.jbpm folder and src/process.examples contain my .par folder.
Then I deployed my process difinition on server deployer /jbpm/upload and this time it worked.
Earlier my process definition and action class was not in the jbpm project rather it was in a separate process project.