我开始使用drools,我想在spring-boot服务中使用它,但即使是一个简单的例子,我在Xstream上也没有这样的方法错误。我错过了什么?
Caused by: java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefaultSecurity(Lcom/thoughtworks/xstream/XStream;)V
at org.kie.internal.xstream.XStreamUtils.internalCreateXStream(XStreamUtils.java:58)
at org.kie.internal.xstream.XStreamUtils.createXStream(XStreamUtils.java:38)
at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.<init>(KieModuleModelImpl.java:170)
at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.<init>(KieModuleModelImpl.java:169)
at org.drools.compiler.kproject.models.KieModuleModelImpl.<clinit>(KieModuleModelImpl.java:167)
at org.drools.compiler.kie.builder.impl.ClasspathKieProject.fetchKModule(ClasspathKieProject.java:179)
at org.drools.compiler.kie.builder.impl.ClasspathKieProject.fetchKModule(ClasspathKieProject.java:141)
at org.drools.compiler.kie.builder.impl.ClasspathKieProject.discoverKieModules(ClasspathKieProject.java:112)
at org.drools.compiler.kie.builder.impl.ClasspathKieProject.init(ClasspathKieProject.java:84)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.<init>(KieContainerImpl.java:142)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieClasspathContainer(KieServicesImpl.java:135)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.getKieClasspathContainer(KieServicesImpl.java:101)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.getKieClasspathContainer(KieServicesImpl.java:79)
答案 0 :(得分:2)
我遇到了类似的问题。该方法是在xstream v1.4.10中引入的。
我能够通过excluding xstream (v1.4.9)
依赖项drools-compiler (v7.6.0.Final)
修复它并为xstream (v1.4.10)
添加单独的依赖项
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>7.6.0.Final</version>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
答案 1 :(得分:1)
| \- org.drools:drools-decisiontables:jar:7.4.1.Final:compile
[INFO] | +- (org.drools:drools-core:jar:7.4.1.Final:compile - omitted for duplicate)
[INFO] | +- org.drools:drools-compiler:jar:7.4.1.Final:compile
[INFO] | | +- (org.drools:drools-core:jar:7.4.1.Final:compile - omitted for duplicate)
[INFO] | | +- (org.kie:kie-api:jar:7.4.1.Final:compile - omitted for duplicate)
[INFO] | | +- (org.kie:kie-internal:jar:7.4.1.Final:compile - omitted for duplicate)
[INFO] | | +- (org.uberfire:uberfire-maven-support:jar:1.4.0.Final:compile - omitted for duplicate)
[INFO] | | +- org.antlr:antlr-runtime:jar:3.5.2:compile
[INFO] | | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] | | +- (org.mvel:mvel2:jar:2.3.2.Final:compile - omitted for duplicate)
[INFO] | | +- (com.thoughtworks.xstream:xstream:jar:1.4.9:compile - version managed from 1.4.10; omitted for duplicate)
drools需要1.4.10版本,但我的maven保留了eureka使用的1.4.9版本(netflix解决方案)
| +- (com.thoughtworks.xstream:xstream:jar:1.4.9:compile - version managed from 1.4.10; omitted for duplicate)
如果我强制使用版本1.4.10,我收到此消息
+- (com.thoughtworks.xstream:xstream:jar:1.4.9:compile - version managed from 1.4.10; omitted for conflict with 1.4.10)
但它正在发挥作用......