Hi and welcome to HCM.
you should first rule out infections which is the most common cause of such difficulties.So look for STD
or epididimitis. Secondly, it can be epididimal cyst
which can obstruct ducts or prostate
This should be evaluated by ultrasound
and urethral swab test. YOu shoul also stop masturbating till pain subsides. Wish you good health.