noushadali / powermock

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

PowerMockRule doesn't work on IntelliJ Idea #522

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I get error: PowerMockRule can only be used with the system classloader but was 
loaded by java.net.URLClassLoader

it's due to code:

static {
        if (PowerMockRule.class.getClassLoader() != ClassLoader.getSystemClassLoader()) {
            throw new IllegalStateException("PowerMockRule can only be used with the system classloader but was loaded by " + PowerMockRule.class.getClassLoader());
        }
        PowerMockAgent.initializeIfPossible();
    }

Original issue reported on code.google.com by iir...@gmail.com on 15 Oct 2014 at 8:25

GoogleCodeExporter commented 9 years ago
it happens only when you have a  big project and lot of maven dependencies, and 
then idea tries to save classpath to a file, and uses a custom classloader 
which loads this classpath

Original comment by iir...@gmail.com on 15 Oct 2014 at 8:45