Fix NPEs when initializing on a servlet container which returns a null contextFolder