Problem integrating identity component
srsuarez Jan 23, 2007 9:58 AMI have a terrible headache from this problem, can anyone help me?
We have tried to integrate JBPM with an old application that uses
struts. The struts app doesnt use hibernate, it only use a connection
pool (proxool).
Well, I read the jbpm userguide and in the chapter about the identity
component it's explained how create a new ExpressionAssignmentHandler
class. Thus, I create a new class that read the expression in the xml
and then connect to the struts app db to resolve the correct actor id.
Thats easy. I try the new class with this example...
---
public class MyTask extends TestCase {
public void testTaskAssignment() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='estoy cabreado'>" +
" <start-state>" +
" " +
" </start-state>" +
" <task-node name='t'>" +
" " +
" " +
" user(alucia)" +
" " +
" " +
" </task-node>" +
" <end-state name='end' />" +
"</process-definition>"
);
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try
{
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
token.signal();
assertSame(processDefinition.getNode("t"), token.getNode());
TaskInstance taskInstance = (TaskInstance)
processInstance
.getTaskMgmtInstance()
.getTaskInstances()
.iterator().next();
assertEquals("user46", taskInstance.getActorId() );
taskInstance.end();
assertSame(processDefinition.getNode("end"), token.getNode());
System.out.println("DEBUG: Finaliza el proceso");
}
finally
{
//jbpmContext.close();
}
}
}
---
This raise the excepcion: "javax.servlet.ServletException: couldn't
delete timers for process instance
org.jbpm.graph.exe.ProcessInstance@15b5783'"
But this isnt the problem (at least in this moment). When I try to load
the process definition with jbpm context, I have a problem with the
proxool driver.
Here's the code that increase my headache:
---
public class MyTask extends TestCase {
public void testTaskAssignment() {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='arghhh'>" +
" <start-state>" +
" " +
" </start-state>" +
" <task-node name='t'>" +
" " +
" " +
" user(alucia)" +
" " +
" " +
" </task-node>" +
" <end-state name='end' />" +
"</process-definition>"
);
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try
{
jbpmContext.deployProcessDefinition(processDefinition);
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition loadProcess =
graphSession.findLatestProcessDefinition("arghhh");
ProcessInstance processInstance =
new ProcessInstance(loadProcess);
Token token = processInstance.getRootToken();
token.signal();
assertSame(processDefinition.getNode("t"), token.getNode());
TaskInstance taskInstance = (TaskInstance)
processInstance
.getTaskMgmtInstance()
.getTaskInstances()
.iterator().next();
assertEquals("user46", taskInstance.getActorId() );
taskInstance.end();
assertSame(processDefinition.getNode("end"), token.getNode());
jbpmContext.save(processInstance);
}
finally
{
jbpmContext.close();
}
}
}
---
This raise:
java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[...]
Caused by: org.logicalcobwebs.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
at
org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
[...]
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
[...]
Caused by: java.lang.LinkageError: duplicate class definition:
$java/lang/Object$$FastClassByCGLIB$$3f697993
at java.lang.ClassLoader.defineClass1(Native Method)
Please HELP. I dont know what to do.
Thanks in advance.