Hi and welcome to HCM.
Mister, you should first rule out urinary infection which is the most common cause of such difficulties. Secodnly, you should look for STD
or other epididimal infection. WHatverev it is it can be easily treated by antibiotics but only after the diagnosis is verified.
And last possible causes are noninfectious such as inguinal hernia
. This should be evaluated by ultrasound
. Wish you good health.