Rule #1 of
JSF: the more JSF-specific code you use, the more likely you're doing it wrong.
Forget the FacesContext.
Create the bean named "userId" as a Managed Bean and inject into whatever bean you had been using to do the getSessionMap().put(). Manipulate the userId bean if/when needed using POJO code.
In the servlet, do an HttpServletRequest().getSession().getAttribute('userId") to obtain the bean for servlet code to use.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.