There is a really good chance that the pain comes from rounded shoulders, muscle imbalance(pecks overpowering back muscles) and lack of flexibility and rom as a result.
There are few things you can do.
Check the proper ROM. Stand against a wall.
Bring your arms to your sides, palms on the wall.
Glide arms up to the shoulder level while keeping shoulder blades, elbows, wrists and hands on the wall.
Rotate palms up.
Keep on going. Note how far you can go WITHOUT arching your back or moving elbows/hands away from wall.
A drill that you may want to make a part of your training is carrying a weight(kettlebell or dumbbell) over your head
. (Link to youtube video of kettlebell "waiters walk", generally safe")
this should help.