If you're receiving an "exploit failed" error message using redsn0w 0.9.9b7 – or any other redsn0w 0.9.9 beta build – to jailbreak an iPhone 4, it seems to be related to the automatic ipsw identification.
Move the iPhone3,1_5.0_9A334_Restore.ipsw into the iPhone Software Updates directory. On OS X this is located in ~/Library/iTunes/iPhone Software Updates.
Re-run redsn0w and the jailbreak will work as expected. Don't forget that it's still a tethered jailbreak.