December 8, 2011

Previous load of class failed: What?

I've just been trying to load a Visualforce page, and every time I did I got the the error:

"Previous load of class failed: xxx**"**

I tried my usual technique of inserting and removing a space in the page controller source so that Eclipse would let me save it again, but that didn't fix it. Then I tried 'Run All Tests' knowing that forces recompilation of everything, still no good.

Going back to looking at the code I noticed my one of my test methods was calling a method on the class with a parameter, when I'd actually just removed that particular overloaded version of the method; somehow this wasn't generating an error on save! I have no idea how or why, but by adding in another intentional error (I passed in two parameters) the compiler then started to report the first one. So if you get this issue but can't see why, write some invalid code in the controller in question and see if that turfs it up.