I agree with the exercise. He might be overthinking or just feeling nervous. Give him a good walk for 30min- to 1 hr before class. My dog would be so anxious I actually had to walk her for an hour (or give her a really good exercise for 30 mins) before I could have her attention and train her.
Abbey: 10 years old German Shepherd
Suki: 10 years old Calico kitty