I had a similar problem with my iPod. It's an iPod classic 80gb Original / 6th gen, model number A1238 (as written on the back chromed / shiny case) or MB147 ( as shown on screen - Settings - About).
It would charge when connected by a cable to the usb port of a computer or tablet - but would NOT charge when using the same cable connected a generic mains usb charger. I tried various chargers with it - but none would work . They WOULD charge my Kindle, phone etc - but they wouldn't charge this iPod.
It was like they weren't compatible. Whenever I tried them with it - as soon as the iPod was connected to a charger - it would turn on - but there was no "lightning symbol" on the battery icon to indicate it was charging.
The cable I was using had a standard usb type A plug on one end and the 30pin "Apple" plug on the other. The usb type A plug (that plugs into the charger or port ) can be seen to have four connectors - call them 1 2 3 4. Connections 1&4 carry the power ( e.g. 5v and 1A) for charging. Connections 2&3 are the data lines connections. The fact that my iPod would charge from a port - but not a charger - led me to think that maybe the port was supplying some sort of data signal - triggering the iPod to accept charging of the battery.
In order to test this - I blanked off the two inner connectors 2&3 with a small piece of paper - and then plugged in the usb plug to a computer port. Sure enough - the iPod turned on - but would not charge. So this confirmed that some sort of signal or voltage level needs to be present on the data lines - connections 2&3 - for this iPod to accept a charge.
I have since read elsewhere that 2.0V present on both connectors 2&3 - will trigger the iPod to accept charging. Anyway in the end I went to eBay and bought a charger that said it was specifically compatible with an iPod classic 6th gen. It was approx £4.50 so I thought it worth a punt. It works!
So the conclusion of all this - is the iPod classic 6th gen needs a compatible charger.