OS X Mountain Lion has a known issue regarding hang during logon. This more commonly occurs after the computer has been sleeping, standby, or locked.
There are a lot of issues that could cause this, and some people have tracked it down to different causes.
However, for me, I got this error / problem message after upgrading from Snow Leopard.
What I realized was that if the WiFi connection is off, the system will hang. If the WiFi / Airport is on, then everything is OK. After doing some research it appears to be related to the Bonjour service.
The solution for me was to make sure I have WiFi / Airport turned on before putting the computer to sleep, locking it, etc, so that it doesn’t hang on the login screen after it wakes up.