How come my nikon D300 lens won't go on anymore?

Okay so, I just recently got a nikion d300. Everytime I put the lens on, it says "lens not attached". However, the lens is attached. But the dots won't line up anymore when I attach the lens. But, I can still see out of it, but it keeps saying "lens not attached". Why is it doing this?

Have you checked the mount for anything stuck in it? If there's anything in there, even a small pebble, it'll block complete loading of the lens.
Also make sure the contacts are clean. Wipe lightly with a lens cleaning cloth - NO LIQUIDS - to get them clean. If the camera and lens can't "talk" that's the message you get.
Barring all that get professional help. Something could have gone wrong with either mount.