Phase transition in one Josephson junction with a side-coupled magnetic impurity