在Activiti中,定义一个流程,该流程包含事件子流程。当启动流程时抛出如下错误信息:
75 [main] INFO org.activiti.engine.ProcessEngines - Initializing process engine using configuration 'file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml'
95 [main] INFO org.activiti.engine.ProcessEngines - initializing process engine for resource file:/F:/Project_All/Eclipase_Workspace/Activiti_test01/bin/activiti.cfg.xml
2015-3-8 21:36:31 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from resource loaded through InputStream
10013 [main] INFO org.activiti.engine.impl.ProcessEngineImpl - ProcessEngine default created
10013 [main] INFO org.activiti.engine.impl.jobexecutor.JobExecutor - Starting up the JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor].
10069 [main] INFO org.activiti.engine.ProcessEngines - initialised process engine default
10070 [Thread-1] INFO org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable - JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor] starting to acquire jobs
10206 [main] INFO org.activiti.engine.impl.bpmn.deployer.BpmnDeployer - Processing resource bpmn/errorStartEventTest01.bpmn20.xml
10690 [main] ERROR org.activiti.engine.impl.interceptor.CommandContext - Error while closing command context
org.activiti.engine.ActivitiException: Errors while parsing:
event definitions only allowed on start event if subprocess is an event subprocess | subStart | line 7 | column 33
at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:205)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:68)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:75)
at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:139)
at com.bug315.event.ErrorStartEventTest01.main(ErrorStartEventTest01.java:17)
Exception in thread "main" org.activiti.engine.ActivitiException: Errors while parsing:
event definitions only allowed on start event if subprocess is an event subprocess | subStart | line 7 | column 33
at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:205)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:86)
at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:42)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:68)
at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:75)
at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:139)
at com.bug315.event.ErrorStartEventTest01.main(ErrorStartEventTest01.java:17)
根据上面的抛出的异常信息得知,是因为错误开始事件不能被定义在一般子流程中,只能定义在事件子流程中,如下面的流程图所示,在BPMN2.0中使用虚线框表示事件子流程,使用实线框表示一般子流程。如下图: