The force applied to the cannonball and cannon is equal. The explosion inside the cannon will generate a pressure which will turn into a force on both cannonball and cannon. The cannon being heavier and fixed to the ground will move a bit, but the cannonball will be thrown away, fired.