I usually see that when ever I crash, /stop, or /restart my server.
There isn't really a way you can prevent it if you're playing on a server such as mineplex.
If you're hosting it yourself, you can add more RAM to the server (if your have some to spare on your computer), or be more careful with your commands. I used to crash mine a lot with worldedit until I got Async worldedit.
Edit: Same thing could be causing it if you are paying for it to be hosted
Edit2: A plugin crashing could also cause it, if you have access to console or the files read though the logs from around the time of you getting the Java error.