I am having the same problem as the original poster!
My iBook is going on 4 years now and I for the past couple weeks it has shut down while PLUGGED IN.
I really don't think it is a battery issue, I just got a new one from apple a few months ago. I am however using a third party AC adapter.
It shuts down while the power adapter is plugged in, but the battery is basically dead. The problem comes when the battery runs down completely. I have a hard time getting the ibook to charge in the first place, often I have to jiggle the end of cord (that plugs into the DC board) around and find a position for it charge. If the battery is completely dead, I only have like 5 seconds to find a good position for the cord before it shuts down again. If i can't get it within the first couple times the computer will boot up from sleep but then shut down immediately.
In the past, if I take the batter out and unplug the charger for a few minutes then it will eventually boot back up (with the time and date reset), but this time it won't!
This is really bad because my thesis is due on Sunday and I really need the computer to work. Luckily I have it backed up, but I am wondering if anyone might know what the issue is. I have heard logic board issues, but I also thought it might be the DC board that the AC cord plugs into. If it is the logic board, does that mean the computer is essentially a goner?
I am going to take it to tekserve tomorrow, but if anyone has any advice I would really appreciate it.