Add tolerance for lack of servlet context listener injection (#12388)

Change-Id: I3b68a7bef4e74ae055d0f2e1d1a2b95313c915b5