I am trying to use PowerMockito for doing some testing on a project which uses a third party library which uses CORBA. I am trying to skip this exception by finding the source of the problem. I didn't succeed to find information about this matter.
This is the simplest code that I can't make it work:
Java class
@RunWith(PowerMockRunner.class)
public class ORBTest {
@Test
public void initORB() throws Exception {
ORB.init();
}
}
pom.xml
<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/VE5zRx">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>1.6.6</version>
</dependency>
</dependencies>
</project>
Log.error
java.lang.LinkageError: loader constraint violation:
when resolving method "sun.corba.EncapsInputStreamFactory.newEncapsInputStream(Lorg/omg/CORBA/ORB;[BI)Lcom/sun/corba/se/impl/encoding/EncapsInputStream;" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl, and the class loader (instance of <bootloader>) for resolved class, sun/corba/EncapsInputStreamFactory, have different Class objects for the type /CORBA/ORB;[BI)Lcom/sun/corba/se/impl/encoding/EncapsInputStream; used in the signature
at com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl.create(ObjectKeyFactoryImpl.java:222)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.<init>(BootstrapResolverImpl.java:59)
at com.sun.corba.se.spi.resolver.ResolverDefault.makeBootstrapResolver(ResolverDefault.java:75)
at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.initializeNaming(ORBConfiguratorImpl.java:419)
at com.sun.corba.se.impl.orb.ORBConfiguratorImpl.configure(ORBConfiguratorImpl.java:151)
at com.sun.corba.se.impl.orb.ORBImpl.postInit(ORBImpl.java:483)
at com.sun.corba.se.impl.orb.ORBImpl.set_parameters(ORBImpl.java:527)
at com.sun.corba.se.impl.orb.ORBSingleton.getFullORB(ORBSingleton.java:453)
at com.sun.corba.se.impl.orb.ORBSingleton.getORBData(ORBSingleton.java:632)
at com.sun.corba.se.spi.orb.ORB.getLogger(ORB.java:477)
at com.sun.corba.se.spi.orb.ORB.getLogWrapper(ORB.java:523)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.get(ORBUtilSystemException.java:54)
at com.sun.corba.se.spi.orb.ORB.<init>(ORB.java:281)
at com.sun.corba.se.impl.orb.ORBSingleton.<init>(ORBSingleton.java:135)
at org.omg.CORBA.ORB.init(ORB.java:292)
at org.test.test.MockitoTest.test(MockitoTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:310)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:89)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:97)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.access$100(PowerMockJUnit47RunnerDelegateImpl.java:59)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$TestExecutorStatement.evaluate(PowerMockJUnit47RunnerDelegateImpl.java:147)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.evaluateStatement(PowerMockJUnit47RunnerDelegateImpl.java:107)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:202)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:144)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:121)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
I'd appreciate if someone could shed me some light here since y don't know what to change to make this work.
Aucun commentaire:
Enregistrer un commentaire