This is a weird one. If you have a free-format project and add to the class path using the class path wizard beware that you add either directories or .jar files. I was picking up all of the files in the JBOSS tomcat directory and also, inadvertently, picked up a couple of XML config files.
It let me add them to the class path and then choked on restarting the IDE and sat there trying to treat the files with the .XML extension as directories, getting an error and going into an infinite loop. I will report this to the netbeans development team.
The only way to fix it is to edit the project.xml file by hand.