How do I troubleshoot my Wi-Fi connection when an exclamation mark appears?
You need to get more information, so please do some troubleshooting and report back.

Troubleshooting steps:


Hold down the Option key while clicking on the Wi-Fi icon in the menu bar and let us know what you see. Lion: New Wi-Fi Diagnostics tool
When you first see the exclamation point appear, open
System Preferences &gt; Network. If you get a window like this one 




with the Self-Assigned IP beside a yellow button, then you were not able to get a local address from the Wi-Fi router's DHCP server. This can happen because the base station is using MAC address restrictions rather than real passwords. This can also happen because the base station has exhausted its available set of local IP address leases.  

When you connect to a network using DHCP, a network router (e.g. the Wi-Fi access point) gives you an IP address to use and promises you can use it for some period of time, which is called a "lease". (This is so there is no confusion about when someone else can start using the IP address that you are using.  You either renew the lease or know you have to stop using that address and get a new one.)  Once the server leases you the IP address, it cannot give it to anyone else until your lease expires.  A typical home router might be set up with only 250 addresses to give out and a lease period of 24 hours.   That's fine at home, but in a heavily trafficked coffee shop, they might get more than 250 Wi-Fi using customers in a day, at which point they would be out of addresses.  Worse, lease times can be much longer (I've seen 14 days on some routers) and DHCP servers can have arbitrarily small numbers of addresses to hand out.  So this really happens sometimes, and it is probably what is happening to you.  

In any case, it's probably a configuration error on the router that the router owner has to fix.