What measures prevent a military aircraft's weapons from being fired on the ground?
Normally with aircraft there is a sensor called a weight on wheels switch.  This tells the computer that the aircraft is on the ground.  The computer (or a system of relays for older air frames) will prevent any system that was designated by the owner, or required by regulations, from activating while in the ground.  Also as a secondary preventative measure certain mechanical systems are also pinned in place after landing to help prevent ground actuation.  However if it happened during maintenance it is very likely these systems were disabled to perform system maintenance on the cannon.