'Galvanic corrosion' and applying a non-metalic layer between the cannon/deck would be my first thought. Now I'm curious as to some of the more 'colorful answers'.
Yes indeed: two different metals in electrical contact through an electrolyte solution (sea water). One way to stop this is to use a sacrificial anode (where the oxidation occurs) made of Magnesium, although this would probably be unpractical in salt water. A colorful answer would be to replace the water with a fluid like 3M's Fluorinert and replace the air with a nitrogen atmosphere. But that would also be unpractical.