[jBPM] Problème de ClassNotFoundException
salut
J'ai essayé de faire les exemples qui se trouvent dans http://docs.jboss.org/jbpm/v3/usergu...ignmentexample
mais j'ai quelques problèmes...
Voici le code de la classe de test:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| package simple;
import junit.framework.TestCase;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class TesterHelloWorldProcess extends TestCase {
public void testTaskAssignment() {
// The process shown below is based on the hello world process.
// The state node is replaced by a task-node. The task-node
// is a node in JPDL that represents a wait state and generates
// task(s) to be completed before the process can continue to
// execute.
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='the baby process'>" +
" <start-state>" +
" <transition name='baby cries' to='t' />" +
" </start-state>" +
" <task-node name='t'>" +
" <task name='change nappy'>" +
" <assignment class='com.sample.action.MyTaskmgmtAssignmentHandler' />" +
" </task>" +
" <transition to='end' />" +
" </task-node>" +
" <end-state name='end' />" +
"</process-definition>"
);
// Create an execution of the process definition.
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
// Let's start the process execution, leaving the start-state
// over its default transition.
token.signal();
// The signal method will block until the process execution
// enters a wait state. In this case, that is the task-node.
assertSame(processDefinition.getNode("t"), token.getNode());
// When execution arrived in the task-node, a task 'change nappy'
// was created and the NappyAssignmentHandler was called to determine
// to whom the task should be assigned. The NappyAssignmentHandler
// returned 'papa'.
// In a real environment, the tasks would be fetched from the
// database with the methods in the org.jbpm.db.TaskMgmtSession.
// Since we don't want to include the persistence complexity in
// this example, we just take the first task-instance of this
// process instance (we know there is only one in this test
// scenario).
TaskInstance taskInstance = (TaskInstance)
processInstance
.getTaskMgmtInstance()
.getTaskInstances()
.iterator().next();
// Now, we check if the taskInstance was actually assigned to 'papa'.
assertEquals("papa", taskInstance.getActorId() );
// Now we suppose that 'papa' has done his duties and mark the task
// as done.
taskInstance.end();
// Since this was the last (only) task to do, the completion of this
// task triggered the continuation of the process instance execution.
assertSame(processDefinition.getNode("end"), token.getNode());
}
} |
voici le code du handler
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| package com.sample.action;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
public class MyTaskmgmtAssignmentHandler implements ActionHandler {
/**
*
*/
private static final long serialVersionUID = 1L;
public void execute(ExecutionContext executionContext) throws Exception {
System.err.println("code executer dans le actionHandler predefini!");
}
} |
et enfin voici l'erreur:
Citation:
00:16:39,701 [main] INFO JbpmConfiguration : using jbpm configuration resource 'jbpm.cfg.xml'
00:16:39,701 [main] DEBUG JbpmConfiguration : loading defaults in jbpm configuration
00:16:39,779 [main] DEBUG ObjectFactoryImpl : adding object info 'default.jbpm.context'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.hibernate.cfg.xml'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.business.calendar'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.default.modules'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.converter'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.action.types'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.node.types'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.parsers'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.varmapping'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'resource.mail.templates'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.byte.block.size'
00:16:39,794 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.task.instance.factory'
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.variable.resolver'
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.smtp.host'
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.address.resolver'
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.mail.from.address'
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpm.job.executor'
00:16:39,810 [main] DEBUG JbpmConfiguration : loading specific configuration...
00:16:39,810 [main] DEBUG ObjectFactoryImpl : adding object info 'jbpmConfiguration'
00:16:39,826 [main] INFO StaleObjectLogConfigurer : stale object exceptions will be hidden from logging
00:16:39,966 [main] DEBUG NodeTypes : node 'page' will not be available. class 'org.jboss.seam.pageflow.Page' couldn't be loaded
00:16:39,966 [main] DEBUG NodeTypes : node 'start-page' will not be available. class 'org.jboss.seam.pageflow.Page' couldn't be loaded
00:16:40,013 [main] DEBUG GraphElement : event 'process-start' on 'ProcessDefinition(the baby process)' for 'Token(/)'
00:16:40,029 [main] DEBUG GraphElement : event 'before-signal' on 'StartState(60991f)' for 'Token(/)'
00:16:40,029 [main] DEBUG GraphElement : event 'node-leave' on 'StartState(60991f)' for 'Token(/)'
00:16:40,029 [main] DEBUG GraphElement : event 'transition' on 'Transition(baby cries)' for 'Token(/)'
00:16:40,029 [main] DEBUG GraphElement : event 'node-enter' on 'TaskNode(t)' for 'Token(/)'
00:16:40,076 [main] DEBUG GraphElement : event 'task-create' on 'Task(change nappy)' for 'Token(/)'
00:16:40,138 [main] ERROR Delegation : couldn't load delegation class 'com.sample.action.MyTaskmgmtAssignmentHandler'
java.lang.ClassNotFoundException: class 'com.sample.action.MyTaskmgmtAssignmentHandler' could not be found by the process classloader
at org.jbpm.instantiation.ProcessClassLoader.findClass(ProcessClassLoader.java:118)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jbpm.instantiation.Delegation.instantiate(Delegation.java:140)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignmentDelegation(TaskMgmtInstance.java:266)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:244)
at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:198)
at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:197)
at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:168)
at org.jbpm.graph.def.Node.enter(Node.java:318)
at org.jbpm.graph.def.Transition.take(Transition.java:151)
at org.jbpm.graph.def.Node.leave(Node.java:393)
at org.jbpm.graph.node.StartState.leave(StartState.java:70)
at org.jbpm.graph.exe.Token.signal(Token.java:192)
at org.jbpm.graph.exe.Token.signal(Token.java:140)
at simple.TesterHelloWorldProcess.testTaskAssignment(TesterHelloWorldProcess.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
.....
Quel est le problème ?
Merci d'avance