项目中的代码是:
public JbpmContext getJbpmContext() {
JbpmConfiguration config = JbpmConfiguration.getInstance();
JbpmContext jc = config.getCurrentJbpmContext() ;
if(jc == null){
jc = config.createJbpmContext() ;
}
return jc ;
}
/**
* 开始一个流程
*/
public void newProcessInstance(String issueperson,String wzId , String approvePersonId){
JbpmContext jc = getJbpmContext() ;
try {
jc.setActorId(issueperson) ;
ProcessDefinition pd = jc.getGraphSession().findLatestProcessDefinition("zwTest") ;
ProcessInstance pi = pd.createProcessInstance() ;
ContextInstance ci = pi.getContextInstance() ;
ci.setVariable("issue_person", issueperson) ;
ci.setVariable( APPROVE_ONE_PERSON , approvePersonId) ;
ci.setVariable( "wzId" , wzId) ;
TaskInstance ti = pi.getTaskMgmtInstance().createStartTaskInstance() ;
ti.setVariable("wzId", wzId) ;
ti.end() ;
} catch (Exception e) {
e.printStackTrace() ;
} finally{
if(jc != null){jc.close() ;}
}
}
执行到ProcessDefinition pd = jc.getGraphSession().findLatestProcessDefinition("zwTest") ;
得时候报出:
18:15:20,125 [http-8082-9] WARN ErrorCounter : *** WARNING: Keyword 'end' is being intepreted as an identifier due to: expecting IDENT, found 'end'
18:15:20,125 [http-8082-9] WARN ErrorCounter : *** WARNING: Keyword 'end' is being intepreted as an identifier due to: expecting IDENT, found 'end'
18:15:20,140 [http-8082-9] ERROR ErrorCounter : *** ERROR: line 3:31: expecting "set", found 'job'
18:15:20,156 [http-8082-9] ERROR ErrorCounter : *** ERROR: org.jbpm.scheduler.exe.Timer is not mapped.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.hibernate.hql.ast.HqlSqlWalker.postProcessDelete(HqlSqlWalker.java:418)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:175)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
at catt.irr.web.struts.action.baseaction.BaseDispatchAction.newProcessInstance(BaseDispatchAction.java:37)
at catt.irr.ncsl.struts.informationaction.InformationAction.AddInfo(InformationAction.java:223)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)