catch NoClassDefFoundError when trying to resolve annotations

(cherry picked from commit 70bb246b97265b3367573d312859e048c6ec097c)