It is possible that this is Netbeans specific issue. Especially if you use "Compile on save option" and have a big project with a lot of dependencies. See here for details.
I had a very similar problem with such (maven-based) project almost on a daily basis, and found a solution using the above link. Better to say variations of solution. Try it like this:
- disable compile on save
- close the problematic project
- close netbeans
- clear cache
- open netbeans and clean&build
please feedback.