Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drools XStream in a spring service

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)
like image 704
Goofyrocks Avatar asked Nov 13 '17 16:11

Goofyrocks


2 Answers

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>
like image 93
Prasanna Avatar answered Nov 13 '22 05:11

Prasanna


|  \- 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....

like image 22
Goofyrocks Avatar answered Nov 13 '22 03:11

Goofyrocks