From what I know about javelins, they're able to render a shield useless, and that's without even hitting the guy holding it.
Was there any tactic in place to defend against this, or was the shield-bearing frontline of an army faced with javelineers always screwed?
You should note that it was only the Roman pilum wat that designed to stick to the shield and make it unusable, as well as bend so that it could not be thrown back. Most javelins were light spears, and soldiers defended against them as they did with other projectiles - with shields and armour.
On the battlefield, skirmishes or light cavalry were often sent to engage enemy skirmishers. Cavalry could ride them down, and your own skirmishers could either engage them in melee, or in a skirmish, where both sides expended their supply of missiles (javelins) - skirmishers often fought in a loose formation (both to be better able to throw or shoot their own missiles and to be able to dodge or move out of the way of enemy missiles). Using skirmishers against other skirmishers were often a waste of projectiles.