其他分享
首页 > 其他分享> > Spring服务中的Drools XStream

Spring服务中的Drools XStream

作者:互联网

我开始使用流口水,我想在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)

解决方法:

我面临着类似的问题.该方法在xstream v1.4.10中引入.

我能够通过排除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>

标签:xstream,drools,spring
来源: https://codeday.me/bug/20191110/2014999.html