[JBoss jBPM] - Re: how to use Decision nodes??????
by minam97531
i could make the process definition work. (the one that i put above with name "mytest"). it's problem was swimlanes that i assigned!
but i still have the same problem, using handler class in decision nodes! :(
when i make new instance of websale process definition, in "check-for-another-web-order" task, if i select either "yes" or "no",i get the following error:
Entering node evaluate-another-web-order
ERROR [com.liferay.jbpm.WorkflowComponentImpl] Task has already ended
i made some changes to the original websale example to make it easier to check.
this is the first time i write a unit test, so i hope it's correct.
here's the unit test:
| import java.util.Collection;
|
| import junit.framework.TestCase;
|
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
| import org.jbpm.taskmgmt.exe.TaskInstance;
|
| public class DecisionTest {
|
| private static final String TEST_PROCESS =
| "<?xml version=\"1.0\" >"
| +"<process-definition name=\"websale\">"
| +"<!-- Event Logging -->"
| +"<event type=\"node-enter\">"
| +"<script>System.out.println(\"Entering node \" + node.getName());</script>"
| +" </event>"
| +"<event type=\"node-leave\">"
| +"<script>System.out.println(\"Leaving node \" + node.getName());</script>"
| +"</event>"
| +"<!-- Swimlanes -->"
| +"<swimlane name=\"user\" />"
| +"<!-- Nodes -->"
| +"<start-state name=\"initiate-process\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"textarea:description\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"save\" to=\"create-new-web-sale-order\" />"
| +"</start-state>"
| +"<task-node name=\"create-new-web-sale-order\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:item\" access=\"read,write,required\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"check-for-another-web-order\" />"
| +"</task-node>"
| +"<task-node name=\"check-for-another-web-order\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"radio:perform-another-order:yes,no\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"decision\">"
| +"</transition>"
| +"</task-node>"
| +"<decision name=\"decision\">"
| +"<handler class=\"com.liferay.jbpm.handler.WebOrderDecisionHandler\" />"
| +"<transition name=\"finished\" to=\"disagree\" />"
| +"<transition name=\"another\" to=\"agree\" />"
| +"</decision>"
| +"<task-node name=\"agree\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:hello\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"end\">"
| +"</transition>"
| +"</task-node>"
| +"<task-node name=\"disagree\">"
| +"<task swimlane=\"user\">"
| +"<controller>"
| +"<variable name=\"text:goodbye\" />"
| +"</controller>"
| +"</task>"
| +"<transition name=\"submit\" to=\"end\">"
| +"</transition>"
| +"</task-node>"
| +"<end-state name=\"end\" />"
| +"</process-definition>";
|
| public void testExpression() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(TEST_PROCESS);
| ProcessInstance processInstance = processDefinition.createProcessInstance();
| processInstance.getContextInstance().setVariable("textarea:description", "something");
| processInstance.signal();
| processInstance.getContextInstance().setVariable("text:item", "book");
| processInstance.signal();
| processInstance.getContextInstance().setVariable("radio:perform-another-order:yes,no", "yes");
| processInstance.signal();
| assertEquals(processDefinition.getNode("agree"), processInstance.getRootToken().getNode());
| }
|
| }
|
and this is WebOrderDecisionHandler.java:
| import org.jbpm.context.exe.ContextInstance;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.node.DecisionHandler;
|
| /**
| * <a href="WebOrderDecisionHandler.java.html"><b><i>View Source</i></b></a>
| *
| * @author Charles May
| *
| */
| public class WebOrderDecisionHandler implements DecisionHandler {
|
| public String decide(ExecutionContext executionContext) throws Exception {
| ContextInstance contextInstance = executionContext.getContextInstance();
|
| String decision = null;
|
| String buyerResponse = (String)contextInstance.getVariable(
| "radio:perform-another-order:yes,no");
|
| if (buyerResponse.equals("yes")) {
| decision = "another";
| }
| else {
| decision = "finished";
| }
|
| return decision;
| }
|
| }
|
one another question: where should i put WebOrderDecisionHandler.class?? maybe i put it in wrong path.
thanks again.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165800#4165800
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165800
17 years, 9 months
[EJB 3.0] - Re: Session bean lookup fails JBoss 5, worked in 4.0.5
by jaikiran
anonymous wrote : 2008-07-21 14:51:17,851 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: com.pearson.ejb3.session.DBUtilBean ejbName: DBUtilBean
This is the point where the JNDI binding happens. You can confirm that in the server.log file, which will contain something like:
| 2008-07-01 14:38:01,359 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: org.myapp.ejb.impl.UserManagerBean ejbName: UserManagerBean
| 2008-07-01 14:38:01,437 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy
| 2008-07-01 14:38:01,437 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy
| 2008-07-01 14:38:01,515 DEBUG [org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory] (main) Binding proxy for UserManagerBean in JNDI at RemoteUserManagerBean
So based on your logs, it looks like a deployment ordering issue.
anonymous wrote : IMPORTANT: By changing from an @Startup Seam component to a startup servlet I was able to get my .jar and .war to deploy successfully.
You mean, no error messages and JBoss boots fine?
anonymous wrote : The startup method, servlet.init(), still fails when trying to lookup DBUtilBean
With what exception? Same as the previous? Can you post those logs too? Also, if the servlet.init() fails, then the deployment too should fail, which seems to contradict your previous statement.
Based on what you have explained so far, this appears to be deployment ordering issue (with Seam?) in 5.0 CR1. I have seen some other user too asking about the deployment ordering based on the contents of application.xml. Let me try out a sample application (without Seam) and see if there are any issues with 5.0 CR1.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165797#4165797
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165797
17 years, 9 months