It's easy enough to defend against a land invasion... shuffle your units around, play rock paper scissors and whittle them down to SOD (stacks of disappointment) However I have been on the receiving end of a massive seaborne invasion of fully upgraded units landing right next to my capital and just crapping things up a lot. This only seems to happen between gunpowder and steampower... I've never seen a massive galleon invasion after I've discovered ironclads which eat galleons for breakfast, but the AI really seems to take advantage of this gap where scads of galleons escorted by frigates can seriously eff your up and honestly the only defense I've found is to build an enormous navy of frigates. When you've got Ragnar and Justinian constantly trying to land giant stacks on your shores you tend to have to focus on frigates just to keep them away. I feel like this is really the only time in the game where the navy can be a threat, cause soon enough you get cruise missiles and bombers (not to mention nukes) which tend to put a stop to seaborne invasions.