It can be caused by insect infestation, mechanical injury, or infectious disease and the damage has probably formed a canker.
A canker is a necrotic, often sunken lesion on a stem, branch, or twig of a plant. If you carefully scrape away the gum and probe the bark beneath, you will find the bark loose and the tissue beneath discolored. Clean the gum away with a sterile knife but do not dig too deeply, then treat with a copper fungicide, available at most lawn and garden stores. Read and follow label instructions.
Keep the tree well watered, watering once a month through the winter, then see how it looks in the spring
. It may recover if there is physical damage which is not too extensive.