tiebin-zhang / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

java.lang.ClassNotFoundException: caught an exception while obtaining a class file for org.powermock.classloading.DeepCloner #443

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Created android hello world project and Android test project

I was exploring  powermockrule with robolectric. 
looking to use powermock methods to test , so i added below 
@Rule
public PowerMockRule rule = new PowerMockRule();

PowerMock rule :powermock-module-junit4-rule-1.4.10.jar
Robolectric    :robolectric-2.0-alpha-1-jar-with-dependencies.jar
Junit 4

on launching the test I got this exception , I am not sure why i get this:

java.lang.RuntimeException: java.lang.ClassNotFoundException: caught an 
exception while obtaining a class file for org.powermock.classloading.DeepCloner
    at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:68)
    at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:34)
    at org.powermock.classloading.ClassloaderExecutor.createDeepCloner(ClassloaderExecutor.java:106)
    at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:88)
    at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:78)
    at org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:49)
    at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:106)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    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:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: caught an exception while 
obtaining a class file for org.powermock.classloading.DeepCloner
    at javassist.Loader.findClass(Loader.java:359)
    at org.robolectric.bytecode.RobolectricClassLoader.findClass(RobolectricClassLoader.java:83)
    at javassist.Loader.loadClass(Loader.java:311)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.robolectric.bytecode.RobolectricClassLoader.loadClass(RobolectricClassLoader.java:52)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.powermock.api.support.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:66)
    ... 21 more
Caused by: org.robolectric.bytecode.IgnorableClassNotFoundException: msg 
because of javassist.NotFoundException: org.powermock.classloading.DeepCloner
    at org.robolectric.bytecode.AndroidTranslator.onLoad(AndroidTranslator.java:71)
    at javassist.Loader.findClass(Loader.java:340)
    ... 28 more

Original issue reported on code.google.com by manu....@gmail.com on 10 May 2013 at 7:14

Attachments:

GoogleCodeExporter commented 9 years ago
Try the java agent rule instead and see if it works better.

Original comment by johan.ha...@gmail.com on 10 Jun 2013 at 5:27