[jboss-user] [JBoss jBPM] - contiunous JBPM errors

MattOwens do-not-reply at jboss.com
Wed Dec 19 07:15:59 EST 2007


Hi,

I am writing a JBPM implmentation for a corporate system. Currently I am not deploying to an application server I am running the process locally as a set of unit tests.  I am deploying the process definitions manually. Below is the code for the unit tests:

public class testProcessManager
{

@BeforeClass
public static void setup()
{		
  LBSJbpmInstance.createSchema();			
}

@Test
public void testCreateDefinition()
{
  JbpmContext context = JbpmConfiguration.getInstance().createJbpmContext();

try
{
URL u  = this.getClass().getResource("/com/ProcessDefinition.xml");
File f = new File(u.getFile());

ProcessDefinition definition  = ProcessDefinition.parseXmlReader(new FileReader(f));
context.getGraphSession().deployProcessDefinition(definition);		
}
catch (FileNotFoundException e)
{
Assert.fail(e.getMessage());
}
finally
{
context.close();		
}

}

@Test
public void testCreateInstance()
{		
JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();

try
{
ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(1);

ProcessInstance processInstance = new ProcessInstance(processDefinition);

ContextInstance contextInstance = (ContextInstance) processInstance.getContextInstance();
contextInstance.createVariable("test", "test");

processInstance.signal();

jbpmContext.save(processInstance);
}
catch (Throwable t)
{
t.printStackTrace();
Assert.fail(t.getMessage());
}
finally
{
jbpmContext.close();
}		
}

@AfterClass
public static void teardown()
{
JbpmConfiguration.getInstance().dropSchema();	
}
}


This code throws the error: org.jbpm.JbpmException: closed JbpmContext in different order then they were created. This does not happen if i remove the processInstance.signal invocation. 

Can anyone explain the nature of this error.

Thanks in advance
M

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114171#4114171

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114171



More information about the jboss-user mailing list