软件版本为:
Activiti:5.17.0
drools:6.2.0.Final
pom.xml依赖为:
<dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-layout</artifactId> <version>5.17.0</version> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-core</artifactId> <version>6.2.0.Final</version> </dependency> <dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>6.2.0.Final</version> </dependency>
@Test public void deployBar() { InputStream input = getClass().getClassLoader().getResourceAsStream("bpmn/ppleave.zip"); System.out.println(input); RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deploy = repositoryService.createDeployment().addZipInputStream(new ZipInputStream(input)) .name("drools测试").deploy(); System.out.println(deploy.getId()); System.out.println(deploy.getName()); }
java.lang.NoClassDefFoundError: org/drools/runtime/rule/AgendaFilter at org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory.createBusinessRuleTaskActivityBehavior(DefaultActivityBehaviorFactory.java:260) at org.activiti.engine.impl.bpmn.parser.handler.BusinessRuleParseHandler.executeParse(BusinessRuleParseHandler.java:37) at org.activiti.engine.impl.bpmn.parser.handler.BusinessRuleParseHandler.executeParse(BusinessRuleParseHandler.java:25) at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:81) at org.activiti.engine.impl.bpmn.parser.handler.AbstractFlowNodeBpmnParseHandler.parse(AbstractFlowNodeBpmnParseHandler.java:27) at org.activiti.engine.impl.bpmn.parser.handler.AbstractActivityBpmnParseHandler.parse(AbstractActivityBpmnParseHandler.java:36) at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:79) at org.activiti.engine.impl.bpmn.parser.BpmnParse.processFlowElements(BpmnParse.java:432) at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.transformProcess(ProcessParseHandler.java:88) at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:49) at org.activiti.engine.impl.bpmn.parser.handler.ProcessParseHandler.executeParse(ProcessParseHandler.java:35) at org.activiti.engine.impl.bpmn.parser.handler.AbstractBpmnParseHandler.parse(AbstractBpmnParseHandler.java:81) at org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers.parseElement(BpmnParseHandlers.java:79) at org.activiti.engine.impl.bpmn.parser.BpmnParse.transformProcessDefinitions(BpmnParse.java:399) at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java:232) at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:112) at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:50) at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:103) at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:37) 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:78) at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156) at com.lala.activiti.ActivitiTest.deployBar(ActivitiTest.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: org.drools.runtime.rule.AgendaFilter at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 51 more
PS :
org.drools.runtime.rule.AgendaFilter
这个类在drools5.x里面存在的,6.x不存在。
我现在要整合activiti+drools6.x 请问,怎么解决这个问题?
请问,这是什么原因?
Causedby:java.lang.ClassNotFoundException:org.drools.runtime.rule.AgendaFilter找不到这个类!
回复<aclass='referer'target='_blank'>@西夏一品堂:不用改成5.x版本的,集成6.x版本的drools的时候需要额外加一个适配器包,将老的api接口的实现切到新版本的drools上来,我刚整合了Activiti5.21.0和Drools6.4.0.Final,亲测可行。http://www.mvnrepository.com/artifact/org.drools/knowledge-api如果把上面drools的版本改成5.x就不会爆这个错了。我现在要整合的是drools6.x。6.x里面没有那个类
不用改成5.x版本的,集成6.x版本的drools的时候需要额外加一个适配器包,将老的api接口的实现切到新版本的drools上来,我刚整合了Activiti <spanstyle="line-height:1.5;font-size:10pt;">5.21.0 <spanstyle="line-height:1.5;font-size:10pt;">和Drools <spanstyle="line-height:1.5;font-size:10pt;">6.4.0.Final<spanstyle="line-height:1.5;font-size:10pt;">,亲测可行。
只需要额外加入的适配器包址:http://www.mvnrepository.com/artifact/org.drools/knowledge-api
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。