My 2 cents
I had this problem today, and tried various cables, wall chargers and computers to get my iPhone to charge but nothing was happening.
A little back story first: Iphone 3g JB 5.1. My phone was plugged into an imac, and it gave me this message, it wasn´t running any apps it was just charging and then I got the error.
Now to the point: After trying many methods, I plugged it into the wall charger once more, with the same chinese cable I have always used, not sure if the wall adapter is legit, but the cable definitely isn´t. In frustration, I hard reset it about 5 to 6 times in a row, and it started to charge. Try continuous hard resets, frustration definitely optional and not recommended.
Might not be the same for all of you, but I hope it might help some of you!
Best of luck!