catch exception when get EntityManager