首页

解决jbpm4.4流程demo报"org.jbpm.api.JbpmException: no process definition with key Leave"异常

标签:JbpmException,jbpm4.4     发布时间:2022-11-09   

一、错误描述

执行jbpm4.4的流程demo测试(完整项目demo),报“org.jbpm.api.JbpmException: no process definition with key 'Leave'”错误异常,异常日志如下

org.jbpm.api.JbpmException: no process definition with key 'Leave'@b@	at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:58)@b@	at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:36)@b@	at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)@b@	at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:50)@b@	at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)@b@	at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)@b@	at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)@b@	at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)@b@	at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:67)@b@	at com.xwood.jbpm4.JBPM4Test.testStartProcessInstance(JBPM4Test.java:35)@b@	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)@b@	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)@b@	at java.lang.reflect.Method.invoke(Method.java:597)@b@	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)@b@	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)@b@	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)@b@	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)@b@	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)@b@	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)@b@	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)@b@	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)@b@	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)@b@	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)@b@	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)@b@	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)@b@	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)@b@	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)@b@	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)@b@	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)@b@	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)@b@	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)@b@### EXCEPTION ###########################################

二、解决方法

修改addResourceFromClasspath的xml流程文件路径(多加Leave目录),具体修改如下(完整项目代码下载

//部署流程定义@b@@Test@b@public void testDeployProcessDefinition() {@b@  processEngine.getRepositoryService()@b@                   .createDeployment()@b@                   .addResourceFromClasspath("leave/Leave.jpdl.xml")@b@                   .addResourceFromClasspath("leave/processimage.png").deploy();@b@}

改为

//部署流程定义@b@@Test@b@public void testDeployProcessDefinition() {@b@    processEngine.getRepositoryService()@b@                                .createDeployment()@b@                                .addResourceFromClasspath("leave/Leave/Leave.jpdl.xml")@b@                                .addResourceFromClasspath("leave/Leave/processimage.jpg").deploy();@b@}

重新运行,日志正常

11:27:20,735 FIN | [WireContext] eagerly initializing org.jbpm.pvm.internal.id.DatabaseIdComposer@b@11:27:20,753 INF | [Environment] Hibernate 3.3.1.GA@b@11:27:20,758 INF | [Environment] hibernate.properties not found@b@11:27:20,762 INF | [Environment] Bytecode provider name : javassist@b@11:27:20,767 INF | [Environment] using JDK 1.4 java.sql.Timestamp handling@b@11:27:20,808 INF | [Configuration] configuring from resource: jbpm.hibernate.cfg.xml@b@11:27:20,808 INF | [Configuration] Configuration resource: jbpm.hibernate.cfg.xml@b@11:27:20,874 INF | [Configuration] Reading mappings from resource : jbpm.repository.hbm.xml@b@11:27:21,030 INF | [Configuration] Reading mappings from resource : jbpm.execution.hbm.xml@b@11:27:21,137 INF | [Configuration] Reading mappings from resource : jbpm.history.hbm.xml@b@11:27:21,177 INF | [Configuration] Reading mappings from resource : jbpm.task.hbm.xml@b@11:27:21,197 INF | [Configuration] Reading mappings from resource : jbpm.identity.hbm.xml@b@11:27:21,213 INF | [Configuration] Configured SessionFactory: null@b@11:27:21,230 INF | [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)@b@11:27:21,230 INF | [DriverManagerConnectionProvider] Hibernate connection pool size: 20@b@11:27:21,230 INF | [DriverManagerConnectionProvider] autocommit mode: false@b@11:27:21,239 INF | [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/jbpm4@b@11:27:21,239 INF | [DriverManagerConnectionProvider] connection properties: {user=root, password=****}@b@11:27:21,455 INF | [Dialect] Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect@b@11:27:21,461 INF | [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)@b@11:27:21,463 INF | [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)@b@11:27:21,467 INF | [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory@b@11:27:21,526 INF | [SessionFactoryImpl] building session factory@b@11:27:22,023 INF | [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured@b@11:27:22,297 FIN | [HibernateSessionResource] ----- beginning hibernate tx 28693170 --------------------------------------------------------@b@11:27:22,315 FIN | [SQL] select propertyim0_.KEY_ as KEY1_2_, propertyim0_.VERSION_ as VERSION2_2_, propertyim0_.VALUE_ as VALUE3_2_ from JBPM4_PROPERTY propertyim0_ limit ?@b@11:27:22,327 FST | [StringType] returning 'next.dbid' as column: KEY1_2_@b@11:27:22,334 FST | [IntegerType] returning '0' as column: VERSION2_2_@b@11:27:22,334 FST | [StringType] returning '1' as column: VALUE3_2_@b@11:27:22,341 FIN | [SQL] select propertyim0_.KEY_ as KEY1_2_0_, propertyim0_.VERSION_ as VERSION2_2_0_, propertyim0_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY propertyim0_ where propertyim0_.KEY_=?@b@11:27:22,342 FST | [StringType] binding 'db.version' to parameter: 1@b@11:27:22,343 INF | [CheckDbCmd] jBPM version info: library[4.4-SNAPSHOT], schema[null]@b@11:27:22,348 FIN | [HibernateSessionResource] ----- committing hibernate tx 7163696 -------------------------------------------------------@b@11:27:22,357 FIN | [HibernateSessionResource] ----- beginning hibernate tx 3192321 --------------------------------------------------------@b@11:27:22,394 INF | [Parser] loading schema resource: jpdl-4.0.xsd@b@11:27:22,395 INF | [Parser] loading schema resource: jpdl-4.2.xsd@b@11:27:22,395 INF | [Parser] loading schema resource: jpdl-4.3.xsd@b@11:27:22,395 INF | [Parser] loading schema resource: jpdl-4.4.xsd@b@11:27:22,425 INF | [Parser] loading schema resource: BPMN20.xsd@b@11:27:22,425 INF | [Parser] loading schema resource: DiagramDefinition.xsd@b@11:27:22,425 INF | [Parser] loading schema resource: DiagramInterchange.xsd@b@11:27:22,425 INF | [Parser] loading schema resource: BpmnDi.xsd@b@11:27:22,426 FIN | [DatabaseDbidGenerator] last id -2 was consumed.  acquiring new block...@b@11:27:22,427 FIN | [HibernateSessionResource] ----- beginning hibernate tx 9961972 --------------------------------------------------------@b@11:27:22,455 FIN | [SQL] select this_.KEY_ as KEY1_2_0_, this_.VERSION_ as VERSION2_2_0_, this_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY this_ where this_.KEY_=?@b@11:27:22,455 FST | [StringType] binding 'next.dbid' to parameter: 1@b@11:27:22,456 FST | [StringType] returning 'next.dbid' as column: KEY1_2_0_@b@11:27:22,457 FST | [IntegerType] returning '0' as column: VERSION2_2_0_@b@11:27:22,457 FST | [StringType] returning '1' as column: VALUE3_2_0_@b@11:27:22,466 FIN | [SQL] update JBPM4_PROPERTY set VERSION_=?, VALUE_=? where KEY_=? and VERSION_=?@b@11:27:22,466 FST | [IntegerType] binding '1' to parameter: 1@b@11:27:22,466 FST | [StringType] binding '10001' to parameter: 2@b@11:27:22,466 FST | [StringType] binding 'next.dbid' to parameter: 3@b@11:27:22,467 FST | [IntegerType] binding '0' to parameter: 4@b@11:27:22,468 FIN | [HibernateSessionResource] ----- committing hibernate tx 15592594 -------------------------------------------------------@b@11:27:22,469 FIN | [DatabaseDbidGenerator] acquired new id block [1-10000]@b@11:27:22,485 FIN | [SQL] select lob_.DBID_, lob_.DBVERSION_ as DBVERSION2_5_, lob_.BLOB_VALUE_ as BLOB3_5_ from JBPM4_LOB lob_ where lob_.DBID_=?@b@11:27:22,486 FST | [LongType] binding '2' to parameter: 1@b@11:27:22,487 FIN | [SQL] select lob_.DBID_, lob_.DBVERSION_ as DBVERSION2_5_, lob_.BLOB_VALUE_ as BLOB3_5_ from JBPM4_LOB lob_ where lob_.DBID_=?@b@11:27:22,487 FST | [LongType] binding '3' to parameter: 1@b@11:27:22,488 WRN | [DeployerManager] WARNING: no objects were deployed! Check if you have configured a correct deployer in your jbpm.cfg.xml file for the type of deployment you want to do.@b@11:27:22,492 FIN | [SQL] insert into JBPM4_DEPLOYMENT (NAME_, TIMESTAMP_, STATE_, DBID_) values (?, ?, ?, ?)@b@11:27:22,492 FST | [TextType] binding null to parameter: 1@b@11:27:22,493 FST | [LongType] binding '0' to parameter: 2@b@11:27:22,493 FST | [StringType] binding 'active' to parameter: 3@b@11:27:22,493 FST | [LongType] binding '1' to parameter: 4@b@11:27:22,494 FIN | [SQL] insert into JBPM4_LOB (DBVERSION_, BLOB_VALUE_, DBID_) values (?, ?, ?)@b@11:27:22,495 FST | [IntegerType] binding '0' to parameter: 1@b@11:27:22,495 FST | [LongType] binding '2' to parameter: 3@b@11:27:22,495 FIN | [SQL] insert into JBPM4_LOB (DBVERSION_, BLOB_VALUE_, DBID_) values (?, ?, ?)@b@11:27:22,498 FST | [IntegerType] binding '0' to parameter: 1@b@11:27:22,498 FST | [LongType] binding '3' to parameter: 3@b@11:27:22,502 FIN | [SQL] update JBPM4_LOB set DEPLOYMENT_=?, NAME_=? where DBID_=?@b@11:27:22,503 FST | [LongType] binding '1' to parameter: 1@b@11:27:22,503 FST | [TextType] binding 'leave/Leave/processdefinition.xml' to parameter: 2@b@11:27:22,504 FST | [LongType] binding '2' to parameter: 3@b@11:27:22,504 FIN | [SQL] update JBPM4_LOB set DEPLOYMENT_=?, NAME_=? where DBID_=?@b@11:27:22,504 FST | [LongType] binding '1' to parameter: 1@b@11:27:22,505 FST | [TextType] binding 'leave/Leave/processimage.jpg' to parameter: 2@b@11:27:22,505 FST | [LongType] binding '3' to parameter: 3@b@11:27:22,510 FIN | [HibernateSessionResource] ----- committing hibernate tx 10329821 -------------------------------------------------------
<<热门下载>>