Usually this error occurs when:
1) The Mojang Server Assistance is down due to a lack of some sort of technical work (In which I am not knowledgeable of)
2)The Server Assistance is down for maintenance due to the upcoming updates thru other Versions that need to be fixed.
3)The Server Assistance is buggy and needed to be fixed with whatever it needs to be fixed with, sort of the same with 2. ^
You're not the only one experiencing these problems, as a lot of the times, I'll get kicked off from a Server due to a Java Error, and when I try to join again, it's most likely because the Service is down, and their Servers are usually buggy, and they need to be fixed.
Hope this answered some of your questions, this is coming from someone who has been experiencing the same thing, so I can identify this glitch in the System with most knowledge.
See you in-game.
~Square