SpringBoot+ Drools 时出现 java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefault...

今天使用 Drools 7.7.0.Final 时出现找不到 com.thoughtworks.xstream.XStream.setupDefaultSecurity的错误,

于是尝试加入了 XStream的包:

  compile ("com.thoughtworks.xstream:xstream:1.4.9")

结果还是一样的报错,点击查看源码的时候真没在 XStream的类里找到 setupDefaultSecurity。
这时候考虑到是不是版本的问题,去XStream的官网找到最新版是 1.4.10。

于是

  compile ("com.thoughtworks.xstream:xstream:1.4.10")

最终解决了这个错误。

Exception:

java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefaultSecurity(Lcom/thoughtworks/xstream/XStream;)V

    at org.kie.soup.commons.xstream.XStreamUtils.internalCreateTrustingXStream(XStreamUtils.java:168)
    at org.kie.soup.commons.xstream.XStreamUtils.createTrustingXStream(XStreamUtils.java:119)
    at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.(KieModuleModelImpl.java:170)
    at org.drools.compiler.kproject.models.KieModuleModelImpl$kModuleMarshaller.(KieModuleModelImpl.java:169)
    at org.drools.compiler.kproject.models.KieModuleModelImpl.(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.(KieContainerImpl.java:125)
    at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieClasspathContainer(KieServicesImpl.java:131)
    at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieClasspathContainer(KieServicesImpl.java:118)
    at com.cook.rest.drools.HelloWorldTest.testHelloWorld(HelloWorldTest.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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.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.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


你可能感兴趣的:(SpringBoot+ Drools 时出现 java.lang.NoSuchMethodError: com.thoughtworks.xstream.XStream.setupDefault...)