定义一个错误开始事件的流程,在部署时抛出event definitions only allowed on start event if subprocess is an event subprocess错误,错误如下:
org.activiti.engine.ActivitiException: Errors while parsing: event definitions only allowed on start event if subprocess is an event subprocess | start2 | line 7 | column 45 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.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37) at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:74) at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:134) at org.cw.activiti.Test5.test(Test5.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:253) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
部署的流程图如下:

根据上面抛出的异常信息,我们可以知道:是因为错误开始事件不能被定义在一般子流程中,只能定义在事件子流程中。BPMN2.0规范中规定了错误开始事件只能使用在事件子流程中,而不能使用在其他的流程中。而上面流程图中的子流程为实线框表示一般的子流程。而虚线框表示事件子流程。因此我们需要修改子流程。

如上图所示:将子流程的Triggered By Event属性勾上,默认是没有勾上的。该属性从字面上就可以理解:事件触发的。选上该属性后,我们就可以看到子流程图变成了虚线框了。再次部署后,即可成功启动流程。
浙公网安备 33010602011771号