开发者社区> 问答> 正文

Activiti + Drools6整合报错:Caused by: java.l?报错

软件版本为:

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 请问,怎么解决这个问题?

请问,这是什么原因?

展开
收起
爱吃鱼的程序员 2020-06-12 14:21:57 905 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    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里面没有那个类

    <arel="nofollow">org.<arel="nofollow">kie.<arel="nofollow">api.<arel="nofollow">runtime.<arel="nofollow">rule.AgendaFilter在哪里改?我也遇到了不知道怎么解决,求思路<imgsrc="http://www.oschina.net/js/ke/plugins/emoticons/images/0.gif"alt="">drools包给个连接
    Activiti整合6.x的Drools,需要额外加入适配器包:http://www.mvnrepository.com/artifact/org.drools/knowledge-api。

    不用改成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

    2020-06-12 14:22:15
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载