Java PowerMock Could not reconfigure JMX java.lang.LinkageError Solution

If you are using Mockito and PowerMock to build mocks for your Java tests and you run into the following error:

2016-05-05 17:31:20,204 main ERROR Could not reconfigure JMX java.lang.LinkageError: loader constraint violation: loader (instance of org/powermock/core/classloader/MockClassLoader) previously initiated loading for a different type with name "javax/management/MBeanServer"
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(
        at org.powermock.core.classloader.MockClassLoader.loadUnmockedClass(
        at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(
        at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(

Simply add the following as a class level annotation:

@PowerMockIgnore( {"*"} )

Leave a Reply