com.thoughtworks.xstream.converters.ConversionException: 无法调用
com.thoughtworks.xstream.converters.ConversionException: Could not call
我遇到了使用 PowerMockito 测试 SpringCamelContext 单元测试的情况,我收到以下消息 error.Does 有人知道如何解决它。如果我申请
@Rule
public PowerMockRule rule = new PowerMockRule();
以及以下依赖项。
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-classloading-xstream</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
然后只有我收到以下错误:
com.thoughtworks.xstream.converters.ConversionException: Could not call java.security.CodeSource.readObject() : null
---- Debugging information ----
message : Could not call java.security.CodeSource.readObject()
cause-exception : java.lang.RuntimeException
cause-message : null
class : java.security.CodeSource
required-type : java.security.CodeSource
converter-type : com.thoughtworks.xstream.converters.reflection.SerializableConverter
path : /org.powermock.modules.junit4.rule.PowerMockStatement/outer-class/fNext/next/next/target/template/camelContext/applicationContextClassLoader/parent/defaultDomain/codesource/java.security.CodeSource
line number : 18917
class[1] : java.security.ProtectionDomain
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[2] : sun.misc.Launcher$ExtClassLoader
class[3] : sun.misc.Launcher$AppClassLoader
class[4] : org.apache.camel.spring.SpringCamelContext
class[5] : org.apache.camel.impl.DefaultProducerTemplate
class[6] : com.narayan.dummy.test.drools.DroolsUnitTest
class[7] : org.junit.internal.runners.statements.InvokeMethod
class[8] : org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks
class[9] : org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks
class[10] : org.powermock.modules.junit4.rule.PowerMockStatement
class[11] : org.powermock.modules.junit4.rule.PowerMockStatement
version : 1.4.7
有人知道怎么解决吗????
为了解决这个问题。我将其替换为以下注释而不是 PowerMockRule。
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
还从 Pom.xml 中删除了依赖项 powermock-module-junit4-rule & powermock-classloading-xstream 并且它有效。
我遇到了使用 PowerMockito 测试 SpringCamelContext 单元测试的情况,我收到以下消息 error.Does 有人知道如何解决它。如果我申请
@Rule
public PowerMockRule rule = new PowerMockRule();
以及以下依赖项。
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-classloading-xstream</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
然后只有我收到以下错误:
com.thoughtworks.xstream.converters.ConversionException: Could not call java.security.CodeSource.readObject() : null
---- Debugging information ----
message : Could not call java.security.CodeSource.readObject()
cause-exception : java.lang.RuntimeException
cause-message : null
class : java.security.CodeSource
required-type : java.security.CodeSource
converter-type : com.thoughtworks.xstream.converters.reflection.SerializableConverter
path : /org.powermock.modules.junit4.rule.PowerMockStatement/outer-class/fNext/next/next/target/template/camelContext/applicationContextClassLoader/parent/defaultDomain/codesource/java.security.CodeSource
line number : 18917
class[1] : java.security.ProtectionDomain
converter-type[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[2] : sun.misc.Launcher$ExtClassLoader
class[3] : sun.misc.Launcher$AppClassLoader
class[4] : org.apache.camel.spring.SpringCamelContext
class[5] : org.apache.camel.impl.DefaultProducerTemplate
class[6] : com.narayan.dummy.test.drools.DroolsUnitTest
class[7] : org.junit.internal.runners.statements.InvokeMethod
class[8] : org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks
class[9] : org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks
class[10] : org.powermock.modules.junit4.rule.PowerMockStatement
class[11] : org.powermock.modules.junit4.rule.PowerMockStatement
version : 1.4.7
有人知道怎么解决吗????
为了解决这个问题。我将其替换为以下注释而不是 PowerMockRule。
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
还从 Pom.xml 中删除了依赖项 powermock-module-junit4-rule & powermock-classloading-xstream 并且它有效。