The reasons of ulcers are many-
*Traumatic ex-due to sharp tooth
*Infections (bacterial, viral, fungal)
*Due to medicine (like-ibuprofen, piroxicam, anti depressants ,anticancer, antihypertensive)
*vit b deficiency
*Immune disorder
*constipation etc...
Next Steps
As your medical history is not available, it is difficult to say the exact reason .Consult dentist or gen. physician with your medical history detail and rule out the exact cause.