Drools XStream in a spring service
Asked Answered
A

2

7

I'm starting to work with drools , I wanted to use it in spring-boot service, but even for a simple example I 've got a no such method error on Xstream. What did I miss?

  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)
Alliber answered 13/11, 2017 at 16:18 Comment(0)
T
6

I was facing a similar issue. That method was introduced in xstream v1.4.10.

I was able to fix it by excluding xstream (v1.4.9) dependency drools-compiler (v7.6.0.Final) and adding a separate dependency for 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>
Tungstic answered 20/3, 2018 at 19:57 Comment(1)
You "should" only have to specify that dependency or just have the exclusion (if that happens to fix it because it's pulling in the right version from somewhere else now), not need both IIRC.Gillis
A
3
|  \- 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 need the 1.4.10 version but my maven keep the 1.4.9 version using by eureka ( a netflix solution)

|  +- (com.thoughtworks.xstream:xstream:jar:1.4.9:compile - version managed from 1.4.10; omitted for duplicate)

If I force the version 1.4.10, I've got this message

+- (com.thoughtworks.xstream:xstream:jar:1.4.9:compile - version managed from 1.4.10; omitted for conflict with 1.4.10)

but it's working....

Alliber answered 14/11, 2017 at 9:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.