0 Replies Latest reply: Feb 9, 2012 1:01 PM by wmcdonald RSS

    PowerMockito jvisualvm profiler throws javassist.NotFoundException

    wmcdonald Newbie

      I have documented this issue here:

      http://code.google.com/p/powermock/issues/detail?id=370

       

      I'm trying to use jvisualvm on a junit test that uses PowerMockito to mock out a new() for a class.  When I run it in eclipse (using jdk 1.6) the junit test works fine.  But if I try and use jvisualvm and instrument the classes in the package, it throws the exception:

       

      java.lang.RuntimeException: javassist.NotFoundException: org.netbeans.lib.profiler.server.ProfilerRuntimeCPUFullInstr
      at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:187)
      at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:147)
      at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at org.pm.PMProfilerTest$1.<init>(PMProfilerTest.java:32)
      at org.pm.PMProfilerTest.setup(PMProfilerTest.java:32)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:129)
      at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:93)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
      at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
      at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
      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:118)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
      at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      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: javassist.NotFoundException: org.netbeans.lib.profiler.server.ProfilerRuntimeCPUFullInstr
      at javassist.ClassPool.get(ClassPool.java:440)
      at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(MockClassLoader.java:180)
      ... 29 more

       

      Is it possible to use PowerMockito and jvisualvm?  If so, what do I need to do?

       

      TVMIA